de.schlichtherle.awt
Class EventQueue

java.lang.Object
  extended by java.awt.EventQueue
      extended by de.schlichtherle.awt.EventQueue

public class EventQueue
extends EventQueue

Subclasses EventQueue in order to provide utility methods for dealing with the AWT Event Queue.

Since:
TrueZIP 6.1
Version:
TrueZIP 6.7
Author:
Christian Schlichtherle

Constructor Summary
EventQueue()
           
 
Method Summary
static void invokeAndWait(Runnable task, boolean interruptibly, long startTimeout)
           
static void invokeAndWaitUninterruptibly(Runnable task)
          Equivalent to invokeAndWaitUninterruptibly(task, 0), but cannot throw an EventDispatchTimeoutException.
static void invokeAndWaitUninterruptibly(Runnable task, long startTimeout)
          Invokes the given task on the AWT Event Dispatching Thread (EDT) and waits until it's finished.
 
Methods inherited from class java.awt.EventQueue
dispatchEvent, getCurrentEvent, getMostRecentEventTime, getNextEvent, invokeAndWait, invokeLater, isDispatchThread, peekEvent, peekEvent, pop, postEvent, push
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventQueue

public EventQueue()
Method Detail

invokeAndWaitUninterruptibly

public static final void invokeAndWaitUninterruptibly(Runnable task)
                                               throws InvocationTargetException
Equivalent to invokeAndWaitUninterruptibly(task, 0), but cannot throw an EventDispatchTimeoutException.

Throws:
InvocationTargetException

invokeAndWaitUninterruptibly

public static final void invokeAndWaitUninterruptibly(Runnable task,
                                                      long startTimeout)
                                               throws EventDispatchTimeoutException,
                                                      InvocationTargetException
Invokes the given task on the AWT Event Dispatching Thread (EDT) and waits until it's finished. If this method is called on the EDT itself, it will just invoke the given task.

If the current thread gets interrupted while waiting for the EDT to finish the task, then waiting is continued normally, but the current thread's interrupt status is set upon return.

Parameters:
task - The Runnable whose run method should be executed synchronously in the EDT.
startTimeout - If positive, then this parameter specifies the maximum time to wait before the EDT starts to process task in milliseconds.
Throws:
IllegalArgumentException - If startTimeout is negative.
EventDispatchTimeoutException - If startTimeout is positive and waiting for the EDT to start processing the task timed out. The task has been cancelled, i.e. it will not be executed.
InvocationTargetException - If an exception is thrown when running task. getCause() yields the cause of this exception, which must be a RuntimeException or an Error.
See Also:
Thread.interrupted()

invokeAndWait

public static void invokeAndWait(Runnable task,
                                 boolean interruptibly,
                                 long startTimeout)
                          throws EventDispatchTimeoutException,
                                 InterruptedException,
                                 InvocationTargetException
Throws:
EventDispatchTimeoutException
InterruptedException
InvocationTargetException