author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 2495 | 3e32bdf43a35 |
child 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 |
/* |
5506 | 2 |
* Copyright (c) 2008, 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 com.sun.java.swing.plaf.gtk.GTKLookAndFeel; |
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 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
|
33 |
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
|
34 |
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
|
35 |
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
|
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 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
38 |
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
|
39 |
|
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 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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
45 |
@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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
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 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
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
|
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 |
|
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
61 |
public static void main(String[] args) throws Exception { |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
62 |
UIManager.setLookAndFeel(new GTKLookAndFeel()); |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
63 |
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
|
64 |
} |
3e32bdf43a35
6635110: GTK problem when testing Sun Studio IDE on snv_77 with jdk1.6 using Gnome window manager
peterz
parents:
diff
changeset
|
65 |
} |