|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class EventQueue

java.lang.Objectjava.awt.EventQueue
- public class EventQueue
- extends java.lang.Object
This class manages a queue of AWTEvent objects that
are posted to it. The AWT system uses only one event queue for all
events.
| Field Summary | |
private AWTEvent |
currentEvent
|
private EventDispatchThread |
dispatchThread
|
private static int |
INITIAL_QUEUE_DEPTH
|
private long |
lastWhen
|
private EventQueue |
next
|
private int |
next_in
|
private int |
next_out
|
private EventQueue |
prev
|
private AWTEvent[] |
queue
|
private boolean |
shutdown
|
| 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(java.lang.Runnable runnable)
Causes runnable to have its run method called in the dispatch thread of the EventQueue. |
static void |
invokeLater(java.lang.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. |
(package private) boolean |
isShutdown()
|
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. |
private void |
setShutdown(boolean b)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
INITIAL_QUEUE_DEPTH
private static final int INITIAL_QUEUE_DEPTH
- See Also:
- Constant Field Values
queue
private AWTEvent[] queue
next_in
private int next_in
next_out
private int next_out
next
private EventQueue next
prev
private EventQueue prev
currentEvent
private AWTEvent currentEvent
lastWhen
private long lastWhen
dispatchThread
private EventDispatchThread dispatchThread
shutdown
private boolean shutdown
| Constructor Detail |
EventQueue
public EventQueue()
- Initializes a new instance of
EventQueue.
| Method Detail |
setShutdown
private void setShutdown(boolean b)
isShutdown
boolean isShutdown()
getNextEvent
public AWTEvent getNextEvent() throws java.lang.InterruptedException
- Returns the next event in the queue. This method will block until
an event is available or until the thread is interrupted.
peekEvent
public AWTEvent peekEvent()
- Returns the next event in the queue without removing it from the queue.
This method will block until an event is available or until the thread
is interrupted.
peekEvent
public AWTEvent peekEvent(int id)
- Returns the next event in the queue that has the specified id
without removing it from the queue.
This method will block until an event is available or until the thread
is interrupted.
postEvent
public void postEvent(AWTEvent evt)
- Posts a new event to the queue.
invokeAndWait
public static void invokeAndWait(java.lang.Runnable runnable) throws java.lang.InterruptedException, java.lang.reflect.InvocationTargetException
- Causes runnable to have its run method called in the dispatch thread of the
EventQueue. This will happen after all pending events are processed. The
call blocks until this has happened. This method will throw an Error if
called from the event dispatcher thread.
- Since:
- 1.2
invokeLater
public static void invokeLater(java.lang.Runnable runnable)
- This arranges for runnable to have its run method called in the
dispatch thread of the EventQueue. This will happen after all
pending events are processed.
- Since:
- 1.2
isDispatchThread
public static boolean isDispatchThread()
- Return true if the current thread is the current AWT event dispatch
thread.
getCurrentEvent
public static AWTEvent getCurrentEvent()
- Return the event currently being dispatched by the event
dispatch thread. If the current thread is not the event
dispatch thread, this method returns null.
- Since:
- 1.4
push
public void push(EventQueue newEventQueue)
- Allows a custom EventQueue implementation to replace this one.
All pending events are transferred to the new queue. Calls to postEvent,
getNextEvent, and peekEvent and others are forwarded to the pushed queue
until it is removed with a pop().
pop
protected void pop()
throws java.util.EmptyStackException
- Transfer any pending events from this queue back to the parent queue that
was previously push()ed. Event dispatch from this queue is suspended.
dispatchEvent
protected void dispatchEvent(AWTEvent evt)
- Dispatches an event. The manner in which the event is dispatched depends
upon the type of the event and the type of the event's source object.
getMostRecentEventTime
public 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.
At present, only
InputEvents,ActionEvents,InputMethodEvents, andInvocationEvents 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().- Since:
- 1.4
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
java.awt.EventQueue