34
34
* @run main DragWindowTest
35
35
*/
36
36
37
- import java .awt .*;
38
- import java .awt .event .*;
39
- import javax .swing .*;
40
-
41
- import java .util .concurrent .*;
37
+ import java .awt .BorderLayout ;
38
+ import java .awt .Component ;
39
+ import java .awt .Rectangle ;
40
+ import java .awt .Robot ;
41
+ import java .awt .Panel ;
42
+ import java .awt .Point ;
43
+ import java .awt .Window ;
44
+ import java .awt .event .InputEvent ;
45
+ import java .awt .event .MouseAdapter ;
46
+ import java .awt .event .MouseEvent ;
47
+ import javax .swing .JFrame ;
48
+ import javax .swing .JLabel ;
49
+ import javax .swing .JButton ;
50
+ import javax .swing .JPanel ;
51
+ import javax .swing .SwingUtilities ;
52
+
53
+ import java .util .concurrent .Callable ;
42
54
43
55
import test .java .awt .regtesthelpers .Util ;
44
56
@@ -55,7 +67,7 @@ public class DragWindowTest {
55
67
public static void main (String [] args ) throws Exception {
56
68
57
69
Robot robot = new Robot ();
58
- robot .setAutoDelay (50 );
70
+ robot .setAutoDelay (100 );
59
71
60
72
SwingUtilities .invokeAndWait (new Runnable () {
61
73
@@ -65,6 +77,7 @@ public void run() {
65
77
}
66
78
});
67
79
80
+ robot .delay (250 );
68
81
robot .waitForIdle ();
69
82
70
83
Point pointToClick = Util .invokeOnEDT (new Callable <Point >() {
@@ -134,6 +147,7 @@ private static void createAndShowGUI() {
134
147
panel .add (button , BorderLayout .CENTER );
135
148
136
149
frame .getContentPane ().add (panel );
150
+ frame .setLocationRelativeTo (null );
137
151
frame .setVisible (true );
138
152
139
153
}
0 commit comments