author | ohair |
Tue, 28 Dec 2010 15:53:50 -0800 | |
changeset 7668 | d4a77089c587 |
parent 5948 | bd26e23a33e0 |
permissions | -rw-r--r-- |
2495
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
1 |
/* |
7668 | 2 |
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
2495
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
4 |
* |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
8 |
* |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
13 |
* accompanied this code). |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
14 |
* |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2495
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
22 |
*/ |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
23 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
24 |
/* @test |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
25 |
@bug 6635110 |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
26 |
@summary GTK icons should not throw NPE when called by non-GTK UI |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
27 |
@author Peter Zhelezniakov |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
28 |
@run main Test6635110 |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
29 |
*/ |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
30 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
31 |
import javax.swing.*; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
32 |
import java.awt.*; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
33 |
import java.awt.image.BufferedImage; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
34 |
import javax.swing.plaf.basic.*; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
35 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
36 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
37 |
public class Test6635110 implements Runnable { |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
38 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
39 |
static final int WIDTH = 160; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
40 |
static final int HEIGHT = 80; |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
41 |
final BufferedImage IMAGE = |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
42 |
new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
43 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
44 |
@Override public void run() { |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
45 |
JMenu menu = new JMenu("menu"); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
46 |
menu.setUI(new BasicMenuUI()); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
47 |
paint(menu); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
48 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
49 |
JToolBar tb = new JToolBar(); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
50 |
tb.setFloatable(true); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
51 |
tb.setUI(new BasicToolBarUI()); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
52 |
paint(tb); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
53 |
} |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
54 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
55 |
void paint(Component c) { |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
56 |
c.setSize(WIDTH, HEIGHT); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
57 |
c.paint(IMAGE.getGraphics()); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
58 |
} |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
59 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
60 |
public static void main(String[] args) throws Exception { |
5948
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
61 |
try { |
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
62 |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); |
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
63 |
} catch (Exception e) { |
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
64 |
System.out.println("GTKLookAndFeel cannot be set, skipping this test"); |
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
65 |
return; |
bd26e23a33e0
6959260: javax/swing/JLabel/6501991/bug6501991.java failed on build 1.7.0-ea-b96
peterz
parents:
5506
diff
changeset
|
66 |
} |
2495
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
67 |
SwingUtilities.invokeAndWait(new Test6635110()); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
68 |
} |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
69 |
} |