author | yan |
Tue, 01 Jul 2014 12:49:36 +0400 | |
changeset 25559 | a101ec6ccfd3 |
child 32427 | c22b7e41adf3 |
permissions | -rw-r--r-- |
25559
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
1 |
/* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
4 |
* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
8 |
* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
13 |
* accompanied this code). |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
14 |
* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
18 |
* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
21 |
* questions. |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
22 |
*/ |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
23 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
24 |
import java.awt.*; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
25 |
import java.awt.image.BufferedImage; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
26 |
import java.lang.ref.PhantomReference; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
27 |
import java.lang.ref.ReferenceQueue; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
28 |
import java.util.ArrayList; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
29 |
import java.util.Vector; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
30 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
31 |
/* |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
32 |
* @test |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
33 |
* @summary Verify that disposed frames are collected with GC |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
34 |
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
35 |
* @library ../../../../lib/testlibrary |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
36 |
* @build ExtendedRobot |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
37 |
* @run main/othervm -Xmx20m FramesGC |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
38 |
*/ |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
39 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
40 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
41 |
public class FramesGC { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
42 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
43 |
ExtendedRobot robot; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
44 |
ArrayList<PhantomReference<Frame>> refs = new ArrayList<PhantomReference<Frame>>(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
45 |
ReferenceQueue<Frame> que = new ReferenceQueue<Frame>(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
46 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
47 |
public static void main(String []args) throws Exception { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
48 |
new FramesGC().doTest(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
49 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
50 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
51 |
FramesGC() throws Exception{ |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
52 |
robot = new ExtendedRobot(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
53 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
54 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
55 |
void doTest() throws Exception { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
56 |
for( int i = 1; i <= 3; i++) { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
57 |
final int j = i; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
58 |
EventQueue.invokeAndWait(() -> { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
59 |
createFrame(j); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
60 |
}); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
61 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
62 |
robot.waitForIdle(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
63 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
64 |
for (Frame f : Frame.getFrames()) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
65 |
f.dispose(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
66 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
67 |
robot.waitForIdle(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
68 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
69 |
Vector garbage = new Vector(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
70 |
while (true) { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
71 |
try { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
72 |
garbage.add(new byte[1000]); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
73 |
} catch (OutOfMemoryError er) { |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
74 |
break; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
75 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
76 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
77 |
garbage = null; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
78 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
79 |
int count = 1; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
80 |
for(; count <= 3; count++) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
81 |
if(que.remove(5000) == null) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
82 |
break; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
83 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
84 |
System.out.println("Total no of instances eligible for GC = " + count); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
85 |
if(count < 3) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
86 |
throw new RuntimeException("Count = "+count+". Test failed!"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
87 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
88 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
89 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
90 |
void createFrame(int i){ |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
91 |
Frame frame = new Frame("Frame " + i); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
92 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
93 |
Button button=new Button("Press Me"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
94 |
TextArea textArea=new TextArea(5,5); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
95 |
TextField textField=new TextField(10); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
96 |
Choice choice=new Choice(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
97 |
choice.add("One"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
98 |
choice.add("Two"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
99 |
choice.add("Three"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
100 |
choice.add("Four"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
101 |
choice.add("Five"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
102 |
List list = new List(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
103 |
list.add("One"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
104 |
list.add("Two"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
105 |
list.add("Three"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
106 |
list.add("Four"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
107 |
list.add("Five"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
108 |
Checkbox checkBox= new Checkbox("Hai"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
109 |
Scrollbar scrollBar=new Scrollbar(Scrollbar.VERTICAL,0,1,0,200); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
110 |
CheckboxGroup checkboxGroup=new CheckboxGroup(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
111 |
Checkbox radioButton=new Checkbox("Hello" ,true, checkboxGroup); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
112 |
Canvas canvas=new Canvas(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
113 |
canvas.setSize(100, 100); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
114 |
canvas.setBackground(java.awt.Color.red); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
115 |
Label label=new Label("I am label.!"); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
116 |
Cursor customCursor=null; |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
117 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
118 |
frame.setLayout(new java.awt.FlowLayout()); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
119 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
120 |
button.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
121 |
label.setCursor(new Cursor(Cursor.TEXT_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
122 |
choice.setCursor(new Cursor(Cursor.WAIT_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
123 |
list.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
124 |
checkBox.setCursor(new Cursor(Cursor.MOVE_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
125 |
radioButton.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
126 |
scrollBar.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
127 |
canvas.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
128 |
textField.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
129 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
130 |
/* create a custom cursor */ |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
131 |
Toolkit toolkit = Toolkit.getDefaultToolkit(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
132 |
Dimension d = toolkit.getBestCursorSize(32,32); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
133 |
int color = toolkit.getMaximumCursorColors(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
134 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
135 |
if(!d.equals(new Dimension(0,0)) && color != 0 ) |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
136 |
customCursor = toolkit.createCustomCursor(new BufferedImage( 16, 16, BufferedImage.TYPE_INT_RGB ), new Point(10, 10), "custom cursor."); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
137 |
else |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
138 |
System.err.println("Platform doesn't support to create a custom cursor."); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
139 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
140 |
textArea.setCursor(customCursor); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
141 |
frame.add(label); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
142 |
frame.add(button); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
143 |
frame.add(choice); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
144 |
frame.add(list); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
145 |
frame.add(checkBox); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
146 |
frame.add(radioButton); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
147 |
frame.add(scrollBar); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
148 |
frame.add(canvas); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
149 |
frame.add(textArea); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
150 |
frame.add(textField); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
151 |
frame.add(button); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
152 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
153 |
frame.setLocation(20, 140 * i); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
154 |
frame.pack(); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
155 |
frame.setVisible(true); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
156 |
refs.add(new PhantomReference<Frame>(frame, que)); |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
157 |
} |
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
158 |
|
a101ec6ccfd3
8043131: Move ShapedAndTranslucentWindows and GC functional AWT tests to regression tree
yan
parents:
diff
changeset
|
159 |
} |