test/java/awt/List/ScrollOutside/ScrollOut.java

Print this page

        

@@ -31,11 +31,10 @@
   @run main ScrollOut
 */
 
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class ScrollOut
 {
     public static final void main(String args[])

@@ -52,33 +51,33 @@
 
         frame.pack();
         frame.setLocationRelativeTo(null);
         frame.setVisible(true);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
 
         try{
             robot = new Robot();
         }catch(AWTException e){
             throw new RuntimeException(e);
         }
+        robot.waitForIdle();
 
         //Drag from center to the outside on left
         Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
                                list.getLocationOnScreen().y + list.getHeight()/2);
         Point to = new Point(list.getLocationOnScreen().x - 30,
                              from.y);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         //Drag from center to the outside on up
         to = new Point(from.x,
                        list.getLocationOnScreen().y - 50);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
         Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
 
     }//End  init()
 }