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 TypeMethodDescriptionvoidaddAWTEventListener(ILcdAWTEventListener aEventListener) Register anAWTEventListenerwhich will be informed every time an event is dispatched into the application using thisTLcdAWTEventDispatcher.static TLcdAWTEventDispatcherReturns a static instance ofTLcdAWTEventDispatcher.voidhandleAWTEvent(AWTEvent aEvent) Dispatches an event, and inform all registered listeners about the event.voidremoveAWTEventListener(ILcdAWTEventListener aEventListener) Remove anAWTEventListenerwhich 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:
handleAWTEventin interfaceILcdAWTEventListener- Parameters:
aEvent- the event to dispatch. Only AWTEvent of which the source is an instance ofComponentare dispatched.- See Also:
-
addAWTEventListener
Register an
AWTEventListenerwhich will be informed every time an event is dispatched into the application using thisTLcdAWTEventDispatcher.- Specified by:
addAWTEventListenerin interfaceILcdAWTEventSource- Parameters:
aEventListener- the listener- See Also:
-
removeAWTEventListener
Remove an
AWTEventListenerwhich was added previously so it will no longer be informed about events which are dispatched into the application.- Specified by:
removeAWTEventListenerin interfaceILcdAWTEventSource- Parameters:
aEventListener- the listener- See Also:
-