jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
changeset 27763 1fba965925e8
parent 23010 6dadb192ad81
child 40128 e635645d2a8a
--- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Sun Nov 09 22:17:45 2014 +0300
+++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Mon Nov 10 16:23:30 2014 +0300
@@ -34,10 +34,17 @@
 
 import static java.awt.GraphicsDevice.WindowTranslucency.*;
 
-import sun.awt.SunToolkit;
 
 public class TranslucentWindow {
     public static void main(String args[]) {
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice gd = ge.getDefaultScreenDevice();
 
@@ -47,10 +54,10 @@
 
         // First, check it can be made fullscreen window without any effects applied
         gd.setFullScreenWindow(f);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         gd.setFullScreenWindow(null);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // Second, check if it applying any effects doesn't prevent the window
         // from going into the fullscreen mode
@@ -64,7 +71,7 @@
             f.setBackground(new Color(0, 0, 0, 128));
         }
         gd.setFullScreenWindow(f);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // Third, make sure all the effects are unset when entering the fullscreen mode
         if (f.getShape() != null) {