/// <summary> /// Waits until all events currently on the event queue have been processed. </summary> /// <exception cref="IllegalThreadStateException"> if called on the AWT event dispatching thread </exception> public virtual void WaitForIdle() { lock (this) { CheckNotDispatchThread(); // post a dummy event to the queue so we know when // all the events before it have been processed try { SunToolkit.flushPendingEvents(); EventQueue.InvokeAndWait(new RunnableAnonymousInnerClassHelper(this)); } catch (InterruptedException ite) { System.Console.Error.WriteLine("Robot.waitForIdle, non-fatal exception caught:"); Console.WriteLine(ite.ToString()); Console.Write(ite.StackTrace); } catch (InvocationTargetException ine) { System.Console.Error.WriteLine("Robot.waitForIdle, non-fatal exception caught:"); Console.WriteLine(ine.ToString()); Console.Write(ine.StackTrace); } } }