equal
deleted
inserted
replaced
38 */ |
38 */ |
39 |
39 |
40 import java.awt.*; |
40 import java.awt.*; |
41 import java.awt.event.*; |
41 import java.awt.event.*; |
42 import java.util.concurrent.atomic.AtomicBoolean; |
42 import java.util.concurrent.atomic.AtomicBoolean; |
43 import sun.awt.SunToolkit; |
|
44 |
43 |
45 |
44 |
46 //*** global search and replace TestAlwaysOnTopBeforeShow with name of the test *** |
45 //*** global search and replace TestAlwaysOnTopBeforeShow with name of the test *** |
47 |
46 |
48 public class TestAlwaysOnTopBeforeShow |
47 public class TestAlwaysOnTopBeforeShow |
51 //*** test-writer defined static variables go here *** |
50 //*** test-writer defined static variables go here *** |
52 |
51 |
53 private static AtomicBoolean focused = new AtomicBoolean(); |
52 private static AtomicBoolean focused = new AtomicBoolean(); |
54 private static AtomicBoolean pressed = new AtomicBoolean(); |
53 private static AtomicBoolean pressed = new AtomicBoolean(); |
55 private static volatile Object pressedTarget; |
54 private static volatile Object pressedTarget; |
|
55 private static Robot robot = null; |
56 private static void init() |
56 private static void init() |
57 { |
57 { |
58 //*** Create instructions for the user here *** |
58 //*** Create instructions for the user here *** |
59 |
59 |
60 Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { |
60 Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { |
121 TestAlwaysOnTopBeforeShow.pass(); |
121 TestAlwaysOnTopBeforeShow.pass(); |
122 |
122 |
123 }//End init() |
123 }//End init() |
124 |
124 |
125 private static void waitForIdle(int mls) { |
125 private static void waitForIdle(int mls) { |
126 ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); |
|
127 try { |
126 try { |
|
127 if(robot == null) { |
|
128 robot = new Robot(); |
|
129 } |
|
130 robot.waitForIdle(); |
128 Thread.sleep(mls); |
131 Thread.sleep(mls); |
129 } catch (InterruptedException e) { |
132 } catch (Exception e) { |
130 e.printStackTrace(); |
133 e.printStackTrace(); |
131 } |
134 } |
132 } |
135 } |
133 |
136 |
134 static void waitFocused(Window w, AtomicBoolean b) { |
137 static void waitFocused(Window w, AtomicBoolean b) { |