|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.EventQueue
public class EventQueue
EventQueue is a platform-independent class that queues events, both from the underlying peer classes and from trusted application classes. There is only one EventQueue for each AppContext.
| Constructor Summary | |
|---|---|
EventQueue()
|
|
| Method Summary | |
|---|---|
protected void |
dispatchEvent(AWTEvent event)
Dispatch an event. |
static AWTEvent |
getCurrentEvent()
Returns the the event currently being dispatched by the EventQueue associated with the calling thread. |
static long |
getMostRecentEventTime()
|
AWTEvent |
getNextEvent()
Remove an event from the EventQueue and return it. |
static void |
invokeAndWait(Runnable runnable)
Causes runnable to have its run() method called in the dispatch thread of the EventQueue. |
static void |
invokeLater(Runnable runnable)
Causes runnable to have its run() method called in the dispatch thread of the EventQueue. |
static boolean |
isDispatchThread()
Returns true if the calling thread is the current AWT EventQueue's dispatch thread. |
AWTEvent |
peekEvent()
Return the first event on the EventQueue without removing it. |
AWTEvent |
peekEvent(int id)
Return the first event with the specified id, if any. |
protected void |
pop()
Stop dispatching events using this EventQueue instance. |
void |
postEvent(AWTEvent theEvent)
Post a 1.1-style event to the EventQueue. |
void |
push(EventQueue newEventQueue)
Replace the existing EventQueue with the specified one. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EventQueue()
| Method Detail |
|---|
public void postEvent(AWTEvent theEvent)
theEvent - an instance of java.awt.AWTEvent, or a
subclass of it.
public AWTEvent getNextEvent()
throws InterruptedException
InterruptedException - if another thread has interrupted this thread.public AWTEvent peekEvent()
public AWTEvent peekEvent(int id)
id - the id of the type of event desired.
protected void dispatchEvent(AWTEvent event)
| Event Type | Source Type | Dispatched To |
|---|---|---|
| ActiveEvent | Any | event.dispatch() |
| Other | Component | source.dispatchEvent(AWTEvent) |
| Other | MenuComponent | source.dispatchEvent(AWTEvent) |
| Other | Other | No action (ignored) |
theEvent - an instance of java.awt.AWTEvent, or a
subclass of it.public void push(EventQueue newEventQueue)
an - EventQueue (or subclass thereof) instance to be used.pop()
protected void pop()
throws EmptyStackException
if - no previous push was made on this EventQueue.
EmptyStackExceptionpush(java.awt.EventQueue)public static boolean isDispatchThread()
public static void invokeLater(Runnable runnable)
runnable - the Runnable whose run() method should be executed
synchronously on the EventQueueinvokeAndWait(java.lang.Runnable)
public static void invokeAndWait(Runnable runnable)
throws InterruptedException,
InvocationTargetException
runnable - the Runnable whose run() method should be executed
synchronously on the EventQueue
InterruptedException - if another thread has
interrupted this thread
InvocationTargetException - if an exception is thrown
when running runnableinvokeLater(java.lang.Runnable)public static long getMostRecentEventTime()
public static AWTEvent getCurrentEvent()
EventQueue associated with the calling thread. This is
useful if a method needs access to the event, but was not designed to
receive a reference to it as an argument. Note that this method should
only be invoked from an application's event dispatching thread. If this
method is invoked from another thread, null will be returned.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||