jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java
changeset 28087 622b2f420bc3
parent 15331 410070becfef
child 39056 d99e63b6d962
--- a/jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java	Fri Dec 05 12:41:29 2014 +0300
+++ b/jdk/test/java/awt/FullScreen/FullScreenInsets/FullScreenInsets.java	Fri Dec 05 14:55:08 2014 +0300
@@ -30,12 +30,9 @@
 import java.awt.GraphicsEnvironment;
 import java.awt.Insets;
 import java.awt.Robot;
-import java.awt.Toolkit;
 import java.awt.Window;
 import java.awt.image.BufferedImage;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 8003173 7019055
@@ -45,6 +42,7 @@
 public final class FullScreenInsets {
 
     private static boolean passed = true;
+    private static Robot robot = null;
 
     public static void main(final String[] args) {
         final GraphicsEnvironment ge = GraphicsEnvironment
@@ -147,7 +145,15 @@
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        if(robot == null) {
+            try {
+                robot = new Robot();
+            }catch(AWTException ae) {
+                ae.printStackTrace();
+                throw new RuntimeException("Cannot create Robot.");
+            }
+        }
+        robot.waitForIdle();
         try {
             Thread.sleep(2000);
         } catch (InterruptedException ignored) {