Class EventQueue

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:

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 before
AWTEvent 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, global
EventQueue for all applets. This behavior is
implementation-dependent. Consult your browser's documentation
for more information.

getMostRecentEventTime

public static long getMostRecentEventTime()

Returns the timestamp of the most recent event that had a timestamp, and
that was dispatched from the EventQueue associated with the
calling thread. If an event with a timestamp is currently being
dispatched, its timestamp will be returned. If no events have yet
been dispatched, the EventQueue's initialization time will be
returned instead.In the current version of
the JDK, only InputEvents,
ActionEvents, and InvocationEvents have
timestamps; however, future versions of the JDK may add timestamps to
additional event types. Note that this method should only be invoked
from an application's event dispatching thread.
If this method is
invoked from another thread, the current system time (as reported by
System.currentTimeMillis()) will be returned instead.

Returns:

the timestamp of the last InputEvent,
ActionEvent, or InvocationEvent to be
dispatched, or System.currentTimeMillis() if this
method is invoked on a thread other than an event dispatching
thread

getCurrentEvent

Returns the the event currently being dispatched by the
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.

Returns:

the event currently being dispatched, or null if this method is
invoked on a thread other than an event dispatching thread