-
-
|
Modifier and Type |
Static Method and Description |
|
getCurrentEvent |
Returns the the event currently being dispatched by the
EventQueue associated with the calling thread.
public static AWTEvent 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
- Since:
- 1.4
|
|
getMostRecentEventTime |
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.
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 InputEvent s,
ActionEvent s, and InvocationEvent s 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 - Since:
- 1.4
- See Also:
InputEvent.getWhen() ,
ActionEvent.getWhen() ,
InvocationEvent.getWhen() ,
isDispatchThread()
|
|
invokeAndWait |
static void invokeAndWait(java.lang.Runnable runnable)
|
|
invokeLater |
static void invokeLater(java.lang.Runnable runnable)
|
|
isDispatchThread |
static boolean isDispatchThread()
|
-
|
Constructor and Description |
|
EventQueue |
|
-
|
Modifier and Type |
Method and Description |
|
createSecondaryLoop |
Creates a new secondary loop associated with this
event queue.
|
|
dispatchEvent |
protected void dispatchEvent(AWTEvent event)
Dispatches an event.
protected void dispatchEvent( 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:
Event Type |
Source Type |
Dispatched To |
ActiveEvent |
Any |
event.dispatch() |
Other |
Component |
source.dispatchEvent(AWTEvent) |
Other |
MenuComponent |
source.dispatchEvent(AWTEvent) |
Other |
Other |
No action (ignored) |
- Parameters:
event - an instance of java.awt.AWTEvent ,
or a subclass of it
- Throws:
java.lang.NullPointerException - if event is null - Since:
- 1.2
|
|
getNextEvent |
Removes an event from the EventQueue and
returns it.
public AWTEvent getNextEvent()
throws java.lang.InterruptedException
-
Removes an event from the EventQueue and
returns it. This method will block until an event has
been posted by another thread.
- Returns:
- the next
AWTEvent
- Throws:
java.lang.InterruptedException - if any thread has interrupted this thread
|
|
peekEvent |
Returns the first event on the EventQueue
without removing it.
-
Returns the first event on the EventQueue
without removing it.
- Returns:
- the first event
|
|
peekEvent |
Returns the first event with the specified id, if any.
-
Returns the first event with the specified id, if any.
- Parameters:
id - the id of the type of event desired
- Returns:
- the first event of the specified id or
null
if there is no such event
|
|
pop |
protected void pop()
Stops dispatching events using this EventQueue .
protected void pop()
throws java.util.EmptyStackException
-
Stops dispatching events using this EventQueue .
Any pending events are transferred to the previous
EventQueue for processing.
Warning: To avoid deadlock, do not declare this method
synchronized in a subclass.
- Throws:
java.util.EmptyStackException - if no previous push was made
on this EventQueue - Since:
- 1.2
- See Also:
push(java.awt.EventQueue)
|
|
postEvent |
void postEvent(AWTEvent theEvent)
Posts a 1.1-style event to the EventQueue .
public void postEvent( AWTEvent theEvent)
-
Posts a 1.1-style event to the EventQueue .
If there is an existing event on the queue with the same ID
and event source, the source Component 's
coalesceEvents method will be called.
- Parameters:
theEvent - an instance of java.awt.AWTEvent ,
or a subclass of it
- Throws:
java.lang.NullPointerException - if theEvent is null
|
|
push |
void push(EventQueue newEventQueue)
Replaces the existing EventQueue with the specified one.
-
Replaces the existing EventQueue with the specified one.
Any pending events are transferred to the new EventQueue
for processing by it.
- Parameters:
newEventQueue - an EventQueue
(or subclass thereof) instance to be use
- Throws:
java.lang.NullPointerException - if newEventQueue is null - Since:
- 1.2
- See Also:
pop()
|
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
This document was created by
Dulcet from the OpenJDK sources.
Copyright © 1993, 2012 Oracle and/or its affiliates. All rights reserved.