src/java.desktop/share/classes/java/awt/Robot.java

Print this page

        

@@ -578,10 +578,21 @@
             throw new IllegalThreadStateException("Cannot call method from the event dispatcher thread");
         }
     }
 
     /**
+     * Synchronizes this toolkit's graphics state. Some window systems
+     * may do buffering of graphics events.
+     * <p>
+     * This method tries to ensure that the display is up-to-date.
+     */
+    public static synchronized void sync() {
+        SunToolkit.flushPendingEvents();
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+    }
+
+    /**
      * Returns a string representation of this Robot.
      *
      * @return  the string representation.
      */
     public synchronized String toString() {