EventQueue (Java Platform SE 8 ) (original) (raw)

public class EventQueue
extends Object
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 callingdispatchEvent(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:
Sequentially.
That is, it is not permitted that several events from this queue are dispatched simultaneously.
In the same order as they are enqueued.
That is, if AWTEvent A is enqueued to the EventQueue beforeAWTEvent B then event B will not be dispatched before event A.
Some browsers partition applets in different code bases into separate contexts, and establish walls between these contexts. In such a scenario, there will be one EventQueue per context. Other browsers place all applets into the same context, implying that there will be only a single, globalEventQueue for all applets. This behavior is implementation-dependent. Consult your browser's documentation for more information.
For information on the threading issues of the event dispatch machinery, see AWT Threading Issues.
Since:
1.1

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.