Package org.fest.swing.listener
Class EventDispatchThreadedEventListener
java.lang.Object
org.fest.swing.listener.EventDispatchThreadedEventListener
- All Implemented Interfaces:
AWTEventListener
,EventListener
@ThreadSafe
public abstract class EventDispatchThreadedEventListener
extends Object
implements AWTEventListener
Understands a
AWTEventListener
that ensures all events are handled on the event dispatch
thread.
NOTE from Abbot: Applet runners may run several simultaneous event dispatch threads when displaying multiple applets simultaneously. If this listener is installed in the parent context of those dispatch threads, it will be invoked on each of those threads, possibly simultaneously.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
eventDispatched
(AWTEvent event) If this method is called in the event dispatch thread, it processes the given event and the queued ones.protected void
Processes any events that were generated off the event queue but not immediately handled.protected abstract void
processEvent
(AWTEvent event) This method is not protected by any synchronization locks (nor should it be); in the presence of multiple simultaneous event dispatch threads, the listener must be thread-safe.
-
Field Details
-
deferredEvents
-
lock
-
processDeferredEventsTask
-
-
Constructor Details
-
EventDispatchThreadedEventListener
public EventDispatchThreadedEventListener()
-
-
Method Details
-
eventDispatched
If this method is called in the event dispatch thread, it processes the given event and the queued ones. Otherwise it will add the given event to the queue and process all the events in the queue in the event dispatch thread.- Specified by:
eventDispatched
in interfaceAWTEventListener
- Parameters:
event
- the event to process.
-
processDeferredEvents
protected void processDeferredEvents()Processes any events that were generated off the event queue but not immediately handled. -
processEvent
This method is not protected by any synchronization locks (nor should it be); in the presence of multiple simultaneous event dispatch threads, the listener must be thread-safe.- Parameters:
event
- the event to process.
-