Additional top-level class in compilation unit: Queue.
EventQueue is a platform-independent class
that queues events, both from the underlying peer classes
and from trusted application classes.
It encapsulates asynchronous event dispatch machinery which
extracts events from the queue and dispatches them by calling
dispatchEvent(AWTEvent) method
on this EventQueue with the event to be dispatched
as an argument. The particular behavior of this machinery is
implementation-dependent. The only requirements are that events
which were actually enqueued to this queue (note that events
being posted to the EventQueue can be coalesced)
are dispatched:
AWTEvent A is enqueued
to the EventQueue before
AWTEvent B then event B will not be
dispatched before event A.
For information on the threading issues of the event dispatch machinery, see AWT Threading Issues.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final ClassLoader | |
| private WeakReference | currentEvent
The modifiers field of the current event, if the current event is an InputEvent or ActionEvent. |
| private EventDispatchThread | |
| private static final int | |
| private static final Runnable | |
| private static volatile PlatformLogger | |
| private FwDispatcher | |
| private static boolean | |
| private static final int | |
| private static final int | |
| private long | |
| private long | |
| private static final int | |
| private final String | |
| private EventQueue | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private EventQueue | |
| private static final Condition | |
| private static final Lock | |
| private Queue[] | |
| private final ThreadGroup | |
| private static final AtomicInteger | |
| private static final int | |
| private static final int | |
| private volatile int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| public SecondaryLoop | Returns: secondaryLoop A new secondary loop object, which can be used to launch a new nested event loop and dispatch events from this queueCreates a new |
| pack-priv SecondaryLoop | |
| pack-priv final void | |
| protected void | dispatchEvent(final AWTEvent
an instance of event)java.awt.AWTEvent,
or a subclass of itDispatches an event. |
| private void | |
| private static int | |
| public static AWTEvent | Returns: the event currently being dispatched, or null if this method is invoked on a thread other than an event dispatching threadReturns the event currently being dispatched by the
|
| private AWTEvent | |
| pack-priv final EventDispatchThread | |
| private static final PlatformLogger | |
| public static long | Returns: the timestamp of the lastInputEvent,
ActionEvent, or InvocationEvent to be
dispatched, or System.currentTimeMillis() if this
method is invoked on a thread other than an event dispatching
threadReturns the timestamp of the most recent event that had a timestamp, and
that was dispatched from the |
| pack-priv long | |
| private long | |
| pack-priv synchronized long | |
| public AWTEvent | |
| pack-priv AWTEvent | |
| pack-priv AWTEvent | |
| private static int | |
| pack-priv final void | |
| public static void | invokeAndWait(Runnable
the runnable)Runnable whose run
method should be executed
synchronously in the
event dispatch thread
of the system EventQueueCauses |
| pack-priv static void | |
| public static void | invokeLater(Runnable
the runnable)Runnable whose run
method should be executed
asynchronously in the
event dispatch thread
of the system EventQueueCauses |
| public static boolean | Returns: true if running inthe current AWT EventQueue's
dispatch threadReturns true if the calling thread is
|
| pack-priv final boolean | |
| private PaintEvent | |
| private boolean | Returns: whether an event is pending on any of the separate QueuesReturns whether an event is pending on any of the separate Queues. |
| public AWTEvent | |
| public AWTEvent | Returns: the first event of the specified id ornull
if there is no such eventthe id of the type of event desired id)Returns the first event with the specified id, if any. |
| protected void | |
| public void | |
| private void | |
| private void | postEventPrivate(AWTEvent
an instance of theEvent)java.awt.AWTEvent,
or a subclass of itPosts a 1.1-style event to the |
| public void | push(EventQueue
an newEventQueue)EventQueue
(or subclass thereof) instance to be useReplaces the existing |
| pack-priv final void | |
| pack-priv static void | |
| private void | |
| private void | |
| private void | |
| private void |
| CACHE_LENGTH | back to summary |
|---|---|
| private static final int CACHE_LENGTH | |
| classLoader | back to summary |
|---|---|
| private final ClassLoader classLoader | |
| currentEvent | back to summary |
|---|---|
| private WeakReference<AWTEvent> currentEvent The modifiers field of the current event, if the current event is an InputEvent or ActionEvent. | |
| dispatchThread | back to summary |
|---|---|
| private EventDispatchThread dispatchThread | |
| DRAG | back to summary |
|---|---|
| private static final int DRAG | |
| dummyRunnable | back to summary |
|---|---|
| private static final Runnable dummyRunnable | |
| eventLog | back to summary |
|---|---|
| private static volatile PlatformLogger eventLog | |
| fwDispatcher | back to summary |
|---|---|
| private FwDispatcher fwDispatcher | |
| fxAppThreadIsDispatchThread | back to summary |
|---|---|
| private static boolean fxAppThreadIsDispatchThread | |
| HIGH_PRIORITY | back to summary |
|---|---|
| private static final int HIGH_PRIORITY | |
| LOW_PRIORITY | back to summary |
|---|---|
| private static final int LOW_PRIORITY | |
| mostRecentEventTime | back to summary |
|---|---|
| private long mostRecentEventTime | |
| mostRecentKeyEventTime | back to summary |
|---|---|
| private long mostRecentKeyEventTime | |
| MOVE | back to summary |
|---|---|
| private static final int MOVE | |
| name | back to summary |
|---|---|
| private final String name | |
| nextQueue | back to summary |
|---|---|
| private EventQueue nextQueue | |
| NORM_PRIORITY | back to summary |
|---|---|
| private static final int NORM_PRIORITY | |
| NUM_PRIORITIES | back to summary |
|---|---|
| private static final int NUM_PRIORITIES | |
| PAINT | back to summary |
|---|---|
| private static final int PAINT | |
| PEER | back to summary |
|---|---|
| private static final int PEER | |
| previousQueue | back to summary |
|---|---|
| private EventQueue previousQueue | |
| pushPopCond | back to summary |
|---|---|
| private static final Condition pushPopCond | |
| pushPopLock | back to summary |
|---|---|
| private static final Lock pushPopLock | |
| queues | back to summary |
|---|---|
| private Queue[] queues | |
| threadGroup | back to summary |
|---|---|
| private final ThreadGroup threadGroup | |
| threadInitNumber | back to summary |
|---|---|
| private static final AtomicInteger threadInitNumber | |
| ULTIMATE_PRIORITY | back to summary |
|---|---|
| private static final int ULTIMATE_PRIORITY | |
| UPDATE | back to summary |
|---|---|
| private static final int UPDATE | |
| waitForID | back to summary |
|---|---|
| private volatile int waitForID | |
| EventQueue | back to summary |
|---|---|
| public EventQueue() Initializes a new instance of | |
| cacheEQItem | back to summary |
|---|---|
| private void cacheEQItem(EventQueueItem entry) | |
| coalesceEvent | back to summary |
|---|---|
| private boolean coalesceEvent(AWTEvent e, int priority) | |
| coalesceMouseEvent | back to summary |
|---|---|
| private boolean coalesceMouseEvent(MouseEvent e) | |
| coalesceOtherEvent | back to summary |
|---|---|
| private boolean coalesceOtherEvent(AWTEvent e, int priority) | |
| coalescePaintEvent | back to summary |
|---|---|
| private boolean coalescePaintEvent(PaintEvent e) | |
| coalescePeerEvent | back to summary |
|---|---|
| private boolean coalescePeerEvent(PeerEvent e) | |
| createSecondaryLoop | back to summary |
|---|---|
| public SecondaryLoop createSecondaryLoop() Creates a new
| |
| createSecondaryLoop | back to summary |
|---|---|
| pack-priv SecondaryLoop createSecondaryLoop(Conditional cond, EventFilter filter, long interval) | |
| detachDispatchThread | back to summary |
|---|---|
| pack-priv final void detachDispatchThread(EventDispatchThread edt) | |
| dispatchEvent | back to summary | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| protected void dispatchEvent(final AWTEvent event) 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:
| ||||||||||||||||
| dispatchEventImpl | back to summary |
|---|---|
| private void dispatchEventImpl(final AWTEvent event, final Object src) Called from dispatchEvent() | |
| eventToCacheIndex | back to summary |
|---|---|
| private static int eventToCacheIndex(AWTEvent e) | |
| getCurrentEvent | back to summary |
|---|---|
| public static AWTEvent getCurrentEvent() Returns the event currently being dispatched by the
| |
| getCurrentEventImpl | back to summary |
|---|---|
| private AWTEvent getCurrentEventImpl() | |
| getDispatchThread | back to summary |
|---|---|
| pack-priv final EventDispatchThread getDispatchThread() | |
| getEventLog | back to summary |
|---|---|
| private static final PlatformLogger getEventLog() | |
| getMostRecentEventTime | back to summary |
|---|---|
| public static long getMostRecentEventTime() Returns the timestamp of the most recent event that had a timestamp, and
that was dispatched from the
| |
| getMostRecentEventTimeEx | back to summary |
|---|---|
pack-priv long getMostRecentEventTimeEx()
| |
| getMostRecentEventTimeImpl | back to summary |
|---|---|
| private long getMostRecentEventTimeImpl() | |
| getMostRecentKeyEventTime | back to summary |
|---|---|
| pack-priv synchronized long getMostRecentKeyEventTime() | |
| getNextEvent | back to summary |
|---|---|
| public AWTEvent getNextEvent() throws InterruptedException Removes an event from the
| |
| getNextEvent | back to summary |
|---|---|
| pack-priv AWTEvent getNextEvent(int id) throws InterruptedException | |
| getNextEventPrivate | back to summary |
|---|---|
| pack-priv AWTEvent getNextEventPrivate() throws InterruptedException | |
| getPriority | back to summary |
|---|---|
| private static int getPriority(AWTEvent theEvent) | |
| initDispatchThread | back to summary |
|---|---|
pack-priv final void initDispatchThread()
| |
| invokeAndWait | back to summary |
|---|---|
| public static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException Causes
| |
| invokeAndWait | back to summary |
|---|---|
| pack-priv static void invokeAndWait(Object source, Runnable runnable) throws InterruptedException, InvocationTargetException | |
| invokeLater | back to summary |
|---|---|
| public static void invokeLater(Runnable runnable) Causes
| |
| isDispatchThread | back to summary |
|---|---|
| public static boolean isDispatchThread() Returns true if the calling thread is
Note use the
| |
| isDispatchThreadImpl | back to summary |
|---|---|
| pack-priv final boolean isDispatchThreadImpl() | |
| mergePaintEvents | back to summary |
|---|---|
| private PaintEvent mergePaintEvents(PaintEvent a, PaintEvent b) | |
| noEvents | back to summary |
|---|---|
| private boolean noEvents() Returns whether an event is pending on any of the separate Queues.
| |
| peekEvent | back to summary |
|---|---|
| public AWTEvent peekEvent() Returns the first event on the
| |
| peekEvent | back to summary |
|---|---|
| public AWTEvent peekEvent(int id) Returns the first event with the specified id, if any.
| |
| pop | back to summary |
|---|---|
| protected void pop() throws EmptyStackException Stops dispatching events using this Warning To avoid deadlock, do not declare this method synchronized in a subclass.
| |
| postEvent | back to summary |
|---|---|
| public void postEvent(AWTEvent theEvent) Posts a 1.1-style event to the
| |
| postEvent | back to summary |
|---|---|
| private void postEvent(AWTEvent theEvent, int priority) Posts the event to the internal Queue of specified priority, coalescing as appropriate.
| |
| postEventPrivate | back to summary |
|---|---|
| private void postEventPrivate(AWTEvent theEvent) Posts a 1.1-style event to the
| |
| push | back to summary |
|---|---|
| public void push(EventQueue newEventQueue) Replaces the existing
| |
| removeSourceEvents | back to summary |
|---|---|
| pack-priv final void removeSourceEvents(Object source, boolean removeAllEvents) | |
| setCurrentEventAndMostRecentTime | back to summary |
|---|---|
| pack-priv static void setCurrentEventAndMostRecentTime(AWTEvent e) | |
| setCurrentEventAndMostRecentTimeImpl | back to summary |
|---|---|
| private void setCurrentEventAndMostRecentTimeImpl(AWTEvent e) | |
| setFwDispatcher | back to summary |
|---|---|
| private void setFwDispatcher(FwDispatcher dispatcher) | |
| uncacheEQItem | back to summary |
|---|---|
| private void uncacheEQItem(EventQueueItem entry) | |
| wakeup | back to summary |
|---|---|
| private void wakeup(boolean isShutdown) | |
| Modifier and Type | Field and Description |
|---|---|
| private final EventFilter | |
| private final SecondaryLoop |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | enter()
Implements java. Blocks the execution of the current thread and enters a new secondary event loop on the event dispatch thread. |
| public boolean | exit()
Implements java. Unblocks the execution of the thread blocked by the |
| filter | back to summary |
|---|---|
| private final EventFilter filter | |
| loop | back to summary |
|---|---|
| private final SecondaryLoop loop | |
| FwSecondaryLoopWrapper | back to summary |
|---|---|
| public FwSecondaryLoopWrapper(SecondaryLoop loop, EventFilter filter) | |
| enter | back to summary |
|---|---|
| public boolean enter() Implements java. Doc from java. Blocks the execution of the current thread and enters a new secondary event loop on the event dispatch thread.
This method can be called by any thread including the event
dispatch thread. This thread will be blocked until the
This method can only start one new event loop at a time per
object. If a secondary event loop has already been started
by this object and is currently still running, this method
returns
| |
| exit | back to summary |
|---|---|
| public boolean exit() Implements java. Doc from java. Unblocks the execution of the thread blocked by the
This method resumes the thread that called the Note that if any other secondary loop is started while this loop is running, the blocked thread will not resume execution until the nested loop is terminated.
If this secondary loop has not been started with the
| |