java.awt
Class EventDispatchThread
java.lang.Object
java.lang.Thread
java.awt.EventDispatchThread
- All Implemented Interfaces:
- Runnable
- class EventDispatchThread
- extends Thread
EventDispatchThread is a package-private AWT class which takes
events off the EventQueue and dispatches them to the appropriate
AWT components.
The Thread starts a "permanent" event pump with a call to
pumpEvents(Conditional) in its run() method. Event handlers can choose to
block this event pump at any time, but should start a new pump (not
a new EventDispatchThread) by again calling pumpEvents(Conditional). This
secondary event pump will exit automatically as soon as the Condtional
evaluate()s to false and an additional Event is pumped and dispatched.
- Since:
- 1.1
- Author:
- Tom Ball, Amy Fowler, Fred Ecks, David Mendenhall
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
dbg
private static final sun.awt.DebugHelper dbg
theQueue
private EventQueue theQueue
doDispatch
private boolean doDispatch
ANY_EVENT
private static final int ANY_EVENT
- See Also:
- Constant Field Values
handlerPropName
private static final String handlerPropName
- See Also:
- Constant Field Values
handlerClassName
private static String handlerClassName
NO_HANDLER
private static String NO_HANDLER
EventDispatchThread
EventDispatchThread(ThreadGroup group,
String name,
EventQueue queue)
stopDispatchingImpl
void stopDispatchingImpl(boolean wait)
stopDispatching
public void stopDispatching()
stopDispatchingLater
public void stopDispatchingLater()
run
public void run()
- Description copied from class:
Thread
- If this thread was constructed using a separate
Runnable
run object, then that
Runnable
object's run
method is called;
otherwise, this method does nothing and returns.
Subclasses of Thread
should override this method.
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
- See Also:
Thread.start()
,
Thread.stop()
,
Thread.Thread(java.lang.ThreadGroup,
java.lang.Runnable, java.lang.String)
,
Runnable.run()
pumpEvents
void pumpEvents(Conditional cond)
pumpEventsForHierarchy
void pumpEventsForHierarchy(Conditional cond,
Component modalComponent)
pumpEvents
void pumpEvents(int id,
Conditional cond)
pumpEventsForHierarchy
void pumpEventsForHierarchy(int id,
Conditional cond,
Component modalComponent)
pumpOneEventForHierarchy
boolean pumpOneEventForHierarchy(int id,
Component modalComponent)
processException
private void processException(Throwable e,
boolean isModal)
handleException
private boolean handleException(Throwable thrown)
- Handles an exception thrown in the event-dispatch thread.
If the system property "sun.awt.exception.handler" is defined, then
when this method is invoked it will attempt to do the following:
- Load the class named by the value of that property, using the
current thread's context class loader,
- Instantiate that class using its zero-argument constructor,
- Find the resulting handler object's public void handle
method, which should take a single argument of type
Throwable, and
- Invoke the handler's handle method, passing it the
thrown argument that was passed to this method.
If any of the first three steps fail then this method will return
false and all following invocations of this method will return
false immediately. An exception thrown by the handler object's
handle will be caught, and will cause this method to return
false. If the handler's handle method is successfully
invoked, then this method will return true. This method will
never throw any sort of exception.
Note: This method is a temporary hack to work around the
absence of a real API that provides the ability to replace the
event-dispatch thread. The magic "sun.awt.exception.handler" property
will be removed in a future release.
- Parameters:
thrown
- The Throwable that was thrown in the event-dispatch
thread
- Returns:
- false if any of the above steps failed, otherwise
true
isDispatching
boolean isDispatching(EventQueue eq)
getEventQueue
EventQueue getEventQueue()