|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.EventQueue
public class EventQueue
This class manages a queue of AWTEvent
objects that
are posted to it. The AWT system uses only one event queue for all
events.
Constructor Summary | |
---|---|
EventQueue()
Initializes a new instance of EventQueue . |
Method Summary | |
---|---|
protected void |
dispatchEvent(AWTEvent evt)
Dispatches an event. |
static AWTEvent |
getCurrentEvent()
Return the event currently being dispatched by the event dispatch thread. |
static long |
getMostRecentEventTime()
Returns the timestamp of the most recent event that had a timestamp, or the initialization time of the event queue if no events have been fired. |
AWTEvent |
getNextEvent()
Returns the next event in the queue. |
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)
This arranges for runnable to have its run method called in the dispatch thread of the EventQueue. |
static boolean |
isDispatchThread()
Return true if the current thread is the current AWT event dispatch thread. |
AWTEvent |
peekEvent()
Returns the next event in the queue without removing it from the queue. |
AWTEvent |
peekEvent(int id)
Returns the next event in the queue that has the specified id without removing it from the queue. |
protected void |
pop()
Transfer any pending events from this queue back to the parent queue that was previously push()ed. |
void |
postEvent(AWTEvent evt)
Posts a new event to the queue. |
void |
push(EventQueue newEventQueue)
Allows a custom EventQueue implementation to replace this one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventQueue()
EventQueue
.
Method Detail |
---|
public AWTEvent getNextEvent() throws InterruptedException
InterruptedException
- If this thread is interrupted while
waiting for an event to be posted to the queue.public AWTEvent peekEvent()
public AWTEvent peekEvent(int id)
id
- The event id to return.
public void postEvent(AWTEvent evt)
evt
- The event to post to the queue.
NullPointerException
- If event is null.public static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException
InterruptedException
- If another thread has interrupted
this thread.
InvocationTargetException
- If an exception is thrown when running
runnable.public static void invokeLater(Runnable runnable)
public static boolean isDispatchThread()
public static AWTEvent getCurrentEvent()
public void push(EventQueue newEventQueue)
NullPointerException
- if newEventQueue is null.protected void pop() throws EmptyStackException
EmptyStackException
- If no previous push was made on this
EventQueue.protected void dispatchEvent(AWTEvent evt)
NullPointerException
- If event is null.public static long getMostRecentEventTime()
InputEvent
s, ActionEvent
s,
InputMethodEvent
s, and InvocationEvent
s have
timestamps, but this may be added to other events in future versions.
If this is called by the event dispatching thread, it can be any
(sequential) value, but to other threads, the safest bet is to return
System.currentTimeMillis().
InputEvent.getWhen()
,
ActionEvent.getWhen()
,
InvocationEvent.getWhen()
,
InputMethodEvent.getWhen()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |