Class TLcdAWTEventDispatcher
- All Implemented Interfaces:
ILcdAWTEventListener
,ILcdAWTEventSource
This class is the central access point for dispatching AWTEvent
(extensions)
and informing all interested parties about it.
Events are dispatched to their source
when this source
is an instance of Component
.
Typically this source will be the most specific
component matching with the event. For example, for a touch event this could be the deepest
component overlapping with the touch
coordinates.
Listeners can be added to this class which will be warned when an event is dispatched. This allows to listen to all events which are inserted into the application.
// add our listener to the dispatcher
aEventDispatcher.addEventListener( new ILcdAWTEventListener(){
public void handleAWTEvent( AWTEvent aEvent ) {
// do something with the event
} };
This is especially useful for debugging purposes.
All methods should be called from the Event Dispatch Thread (EDT).
- Since:
- 10.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAWTEventListener
(ILcdAWTEventListener aEventListener) Register anAWTEventListener
which will be informed every time an event is dispatched into the application using thisTLcdAWTEventDispatcher
.static TLcdAWTEventDispatcher
Returns a static instance ofTLcdAWTEventDispatcher
.void
handleAWTEvent
(AWTEvent aEvent) Dispatches an event, and inform all registered listeners about the event.void
removeAWTEventListener
(ILcdAWTEventListener aEventListener) Remove anAWTEventListener
which was added previously so it will no longer be informed about events which are dispatched into the application.
-
Method Details
-
getInstance
Returns a static instance ofTLcdAWTEventDispatcher
. This technique is known as the singleton pattern.- Returns:
- the common instance of
TLcdAWTEventDispatcher
.
-
handleAWTEvent
Dispatches an event, and inform all registered listeners about the event.
The event is directly dispatched to its source.- Specified by:
handleAWTEvent
in interfaceILcdAWTEventListener
- Parameters:
aEvent
- the event to dispatch. Only AWTEvent of which the source is an instance ofComponent
are dispatched.- See Also:
-
addAWTEventListener
Register an
AWTEventListener
which will be informed every time an event is dispatched into the application using thisTLcdAWTEventDispatcher
.- Specified by:
addAWTEventListener
in interfaceILcdAWTEventSource
- Parameters:
aEventListener
- the listener- See Also:
-
removeAWTEventListener
Remove an
AWTEventListener
which was added previously so it will no longer be informed about events which are dispatched into the application.- Specified by:
removeAWTEventListener
in interfaceILcdAWTEventSource
- Parameters:
aEventListener
- the listener- See Also:
-