summaryrefslogtreecommitdiffstats
path: root/libjava/java/awt/Robot.java
diff options
context:
space:
mode:
authorfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-22 06:18:59 +0000
committerfitzsim <fitzsim@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-22 06:18:59 +0000
commitfaed928296cabbe26e7c529f4de574cdc71fa6ed (patch)
treefd9a1d57ef0371391772820cac8168d93affa1b2 /libjava/java/awt/Robot.java
parent1654f4cdc1c61a323713c2cded344bdfc377ed94 (diff)
downloadppe42-gcc-faed928296cabbe26e7c529f4de574cdc71fa6ed.tar.gz
ppe42-gcc-faed928296cabbe26e7c529f4de574cdc71fa6ed.zip
2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/Robot.java (waitForIdle): Call invokeAndWait on an empty Runnable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95384 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/awt/Robot.java')
-rw-r--r--libjava/java/awt/Robot.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/libjava/java/awt/Robot.java b/libjava/java/awt/Robot.java
index 49726c8a192..23b6f810442 100644
--- a/libjava/java/awt/Robot.java
+++ b/libjava/java/awt/Robot.java
@@ -40,6 +40,7 @@ package java.awt;
import gnu.java.awt.ClasspathToolkit;
+import java.lang.reflect.InvocationTargetException;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.awt.peer.RobotPeer;
@@ -53,8 +54,8 @@ import java.awt.peer.RobotPeer;
*
* Since Robot generates native windowing system events, rather than
* simply inserting {@link AWTEvents} on the AWT event queue, its use
- * is not restricted to Java programs. It can be to programatically
- * drive any graphical application.
+ * is not restricted to Java programs. It can be used to
+ * programatically drive any graphical application.
*
* This implementation requires an X server that supports the XTest
* extension.
@@ -384,7 +385,8 @@ public class Robot
}
/**
- * Wait until the event dispatch thread is idle.
+ * Wait until all events currently on the event queue have been
+ * dispatched.
*/
public void waitForIdle ()
{
@@ -393,17 +395,17 @@ public class Robot
+ "the event dispatch thread");
EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
-
- while (q.peekEvent () != null)
+ try
+ {
+ q.invokeAndWait (new Runnable () { public void run () { } });
+ }
+ catch (InterruptedException e)
+ {
+ System.err.println ("Robot: waitForIdle interrupted");
+ }
+ catch (InvocationTargetException e)
{
- try
- {
- wait ();
- }
- catch (InterruptedException e)
- {
- System.err.println ("Robot: waitForIdle interrupted");
- }
+ System.err.println ("Robot: waitForIdle cannot invoke target");
}
}
OpenPOWER on IntegriCloud