Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.EventQueue

java.lang.Object
    |
    +----java.awt.EventQueue

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. There is only one EventQueue for the system.


Constructor Summary
 EventQueue()
 
 

Method Summary
void  addEventQueueListener(EventQueueListener l)
Adds an EventListener to receive AWTEvents from this EventQueue.
void  dispatchEvent(AWTEvent event)
Dispatch an event to its source.
AWTEvent  getNextEvent()
Remove an event from the queue and return it.
static boolean  isDispatchThread()
Returns true if the calling thread is this EventQueue's dispatch thread.
void  notifyEventQueueListeners(AWTEvent theEvent)
This method notifies any EventQueueListeners that an event has been posted to the EventQueue.
AWTEvent  peekEvent()
Return the first event without removing it.
AWTEvent  peekEvent(int id)
 
void  pop()
Stop dispatching events using this EventQueue instance.
void  postEvent(AWTEvent theEvent)
Post a 1.1-style event to the EventQueue.
void  push(EventQueue newEventQueue)
Replace the existing EventQueue with the specified one.
void  removeEventQueueListener(EventQueueListener l)
Removes an EventListener so that it no longer receives events from this EventQueue.
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventQueue

public EventQueue()
Method Detail

postEvent

public void postEvent(AWTEvent theEvent)
Post a 1.1-style event to the EventQueue.
Parameters:
theEvent - an instance of java.awt.AWTEvent, or a subclass of it.

getNextEvent

public AWTEvent getNextEvent() throws InterruptedException
Remove an event from the queue and return it. This method will block until an event has been posted by another thread.
Returns:
the next AWTEvent
Throws:
InterruptedException - if another thread has interrupted this thread.

peekEvent

public AWTEvent peekEvent()
Return the first event without removing it.
Returns:
the first event, which is either an instance of java.awt.Event or java.awt.AWTEvent.

peekEvent

public AWTEvent peekEvent(int id)

dispatchEvent

protected void dispatchEvent(AWTEvent event)
Dispatch an event to its source.
Parameters:
theEvent - an instance of java.awt.AWTEvent, or a subclass of it.

push

public void push(EventQueue newEventQueue)
Replace the existing EventQueue with the specified one. Any pending events are transferred to the new EventQueue for processing by it.
Parameters:
an - EventQueue (or subclass thereof) instance to be used.

pop

protected void pop() throws EmptyStackException
Stop dispatching events using this EventQueue instance. Any pending events are transferred to the previous EventQueue for processing by it. If called from the initial EventQueue for this AWTContext, an EmptyStackException is thrown.

isDispatchThread

public static boolean isDispatchThread()
Returns true if the calling thread is this EventQueue's dispatch thread. Use this call the ensure that a given task is being executed (or not being) on the current EventDispatchThread.
Returns:
true if running on this EventQueue's dispatch thread.

addEventQueueListener

public void addEventQueueListener(EventQueueListener l)
Adds an EventListener to receive AWTEvents from this EventQueue. Listeners continue receiving events if a new EventQueue is pushed or an existing one is popped.

Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing.

Parameters:
l - the event listener.
See Also:
java.awt.EventQueueListener, removeEventQueueListener

removeEventQueueListener

public void removeEventQueueListener(EventQueueListener l)
Removes an EventListener so that it no longer receives events from this EventQueue.

Note: event listener use is not recommended for normal application use, but are intended solely to support special purpose facilities including support for accessibility, event record/playback, and diagnostic tracing.

Parameters:
l - the event listener.
See Also:
java.awt.EventQueueListener, addEventQueueListener

notifyEventQueueListeners

protected void notifyEventQueueListeners(AWTEvent theEvent)
This method notifies any EventQueueListeners that an event has been posted to the EventQueue. If an EventQueue subclass overrides postEvent, it must either call this method or call super.postEvent(event).
Parameters:
theEvent - the event which has been posted to the EventQueue.

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.