Mega Code Archive
Introducing Untyped Listeners
The untyped listener interface is represented by the Listener interface
It contains one method: void handleEvent(Event event)
Event Members
MemberDescription
int buttonThe one-based index of the button that was clicked or released.
char characterThe character that was typed.
int countThe number of pending paint events.
Object dataApplication-specific data.
int detailA detail constant from the SWT class that contains details about the event.
Display displayThe display where the event occurred.
boolean doitA flag indicating whether to process this event. Not supported for all events.
int endThe end of the range of modified text.
GC gcThe graphics context associated with this event.
int heightThe height in pixels of the rectangle that needs painting.
Widget itemThe widget where the event occurred.
int keyCodeThe key code of the key that was typed.
int startThe beginning of the range of modified text.
int stateMaskThe mask describing the state of the modifier keys at the time of the event.
String textThe text to insert.
int timeThe event's time.
int typeThe type of the event. This is the field to switch on to handle the various event types.
Widget widgetThe widget that issued the event.
int widthThe width in pixels of the rectangle that needs painting.
int xEither the x offset of the rectangle that needs painting or the x coordinate of the mouse pointer at the time of the event, depending n the event.
int yEither the y offset of the rectangle that needs painting or the y coordinate of the mouse pointer at the time of the event, depending on the event.
To add an untyped listener to a widget, call addListener() on it.
void addListener(int eventType, Listener listener)
eventType contains one of the event type constants from the SWT class:
TypeDescription
SWT.ActivateTriggered when the widget becomes the active window
SWT.ArmTriggered when the widget is armed
SWT.CloseTriggered when the widget is closed
SWT.CollapseTriggered when a tree node is collapsed
SWT.DeactivateTriggered when the widget is no longer the active window
SWT.DefaultSelectionTriggered when the default selection occurs
SWT.DeiconifyTriggered when the widget is restored from being minimized
SWT.DisposeTriggered when the widget is disposed
SWT.DragDetectTriggered when the widget is dragged
SWT.ExpandTriggered when a tree node is expanded
SWT.FocusInTriggered when the widget gains focus
SWT.FocusOutTriggered when the widget loses focus
SWT.HardKeyDownTriggered when a special hardware key, such as on a Pocket PC device, is pressed
SWT.HardKeyUpTriggered when a special hardware key, such as on a Pocket PC device, is released
SWT.HelpTriggered when the user requests help
SWT.HideTriggered when the widget is hidden
SWT.IconifyTriggered when the widget is minimized
SWT.KeyDownTriggered when the user presses a key
SWT.KeyUpTriggered when the user releases a key
SWT.MenuDetectTriggered when a menu is selected
SWT.ModifyTriggered when the text of a widget is modified
SWT.MouseDoubleClickTriggered when the mouse is double-clicked
SWT.MouseDownTriggered when the mouse button is clicked
SWT.MouseEnterTriggered when the mouse pointer enters the widget
SWT.MouseExitTriggered when the mouse pointer exits the widget
SWT.MouseHoverTriggered when the mouse pointer hovers over the widget
SWT.MouseMoveTriggered when the mouse pointer moves through the widget
SWT.MouseUpTriggered when the mouse button is released
SWT.MoveTriggered when the widget is moved
SWT.NoneNull event
SWT.PaintTriggered when the widget is painted
SWT.ResizeTriggered when the widget is resized
SWT.SelectionTriggered when the widget is selected
SWT.ShowTriggered when the widget is shown
SWT.TraverseTriggered when the user tabs through the controls
SWT.VerifyTriggered when the text for the widget is about to change, allowing you to veto the change