Package org.eclipse.swt.widgets
Class Event
java.lang.Object
org.eclipse.swt.widgets.Event
Instances of this class provide a description of a particular event which
 occurred within SWT. The SWT untyped listener API uses these
 instances for all event dispatching.
 
Note: For a given event, only the fields which are appropriate will be filled in. The contents of the fields which are not used by the event are unspecified.
- Since:
- 1.0
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionintthe button that was pressed or released; 1 for the first button, 2 for the second button, and 3 for the third button, etc.chardepending on the event, the character represented by the key that was typed.intdepending on the event type, the number of following paint events which are pending which may always be zero on some platforms or the number of lines or pages to scroll using the mouse wheela field for application useintthe event specific detail field, as defined by the detail constants in classSWTthe display where the event occurredbooleandepending on the event, a flag indicating whether the operation should be allowed.intdepending on the event, the range of text being modified.the graphics context to use when painting that is configured to use the colors, font and damaged region of the control.intthe height of the bounding rectangle of the region that requires paintingintthe index of the item where the event occurredthe item that the event occurred in (can be null)intdepending on the event, the key code of the key that was typed, as defined by the key code constants in classSWT.intdepending on the event, the range of text being modified.intdepending on the event, the state of the keyboard modifier keys and mouse masks at the time the event was generated.depending on the event, the new text that will be inserted.intthe time that the event occurred.intthe type of event, as defined by the event type constants in classSWTthe widget that issued the eventintthe width of the bounding rectangle of the region that requires paintingintdepending on the event type, the x offset of the bounding rectangle of the region that requires painting or the widget-relative, x coordinate of the pointer at the time the mouse button was pressed or releasedintdepending on the event type, the y offset of the bounding rectangle of the region that requires painting or the widget-relative, y coordinate of the pointer at the time the mouse button was pressed or released
- 
Constructor SummaryConstructors
- 
Method Summary
- 
Field Details- 
displaythe display where the event occurred
- 
widgetthe widget that issued the event
- 
typepublic int typethe type of event, as defined by the event type constants in classSWT- See Also:
 
- 
detailpublic int detailthe event specific detail field, as defined by the detail constants in classSWT- See Also:
 
- 
itemthe item that the event occurred in (can be null)
- 
indexpublic int indexthe index of the item where the event occurred
- 
gcthe graphics context to use when painting that is configured to use the colors, font and damaged region of the control. It is valid only during the paint and must not be disposed- Since:
- 1.3
 
- 
xpublic int xdepending on the event type, the x offset of the bounding rectangle of the region that requires painting or the widget-relative, x coordinate of the pointer at the time the mouse button was pressed or released
- 
ypublic int ydepending on the event type, the y offset of the bounding rectangle of the region that requires painting or the widget-relative, y coordinate of the pointer at the time the mouse button was pressed or released
- 
widthpublic int widththe width of the bounding rectangle of the region that requires painting
- 
heightpublic int heightthe height of the bounding rectangle of the region that requires painting
- 
countpublic int countdepending on the event type, the number of following paint events which are pending which may always be zero on some platforms or the number of lines or pages to scroll using the mouse wheel
- 
timepublic int timethe time that the event occurred. NOTE: This field is an unsigned integer and should be AND'ed with 0xFFFFFFFFL so that it can be treated as a signed long.
- 
buttonpublic int buttonthe button that was pressed or released; 1 for the first button, 2 for the second button, and 3 for the third button, etc.
- 
characterpublic char characterdepending on the event, the character represented by the key that was typed. This is the final character that results after all modifiers have been applied. For example, when the user types Ctrl+A, the character value is 0x01 (ASCII SOH). It is important that applications do not attempt to modify the character value based on a stateMask (such as SWT.CTRL) or the resulting character will not be correct.
- 
keyCodepublic int keyCodedepending on the event, the key code of the key that was typed, as defined by the key code constants in classSWT. When the character field of the event is ambiguous, this field contains the unaffected value of the original character. For example, typing Ctrl+M or Enter both result in the character '\r' but the keyCode field will also contain '\r' when Enter was typed and 'm' when Ctrl+M was typed.- See Also:
 
- 
stateMaskpublic int stateMaskdepending on the event, the state of the keyboard modifier keys and mouse masks at the time the event was generated.- See Also:
 
- 
startpublic int startdepending on the event, the range of text being modified. Setting these fields has no effect.
- 
endpublic int enddepending on the event, the range of text being modified. Setting these fields has no effect.
- 
textdepending on the event, the new text that will be inserted. Setting this field will change the text that is about to be inserted or deleted.
- 
doitpublic boolean doitdepending on the event, a flag indicating whether the operation should be allowed. Setting this field to false will cancel the operation.
- 
dataa field for application use
 
- 
- 
Constructor Details- 
Eventpublic Event()
 
- 
- 
Method Details- 
getBoundsGets the bounds.- Returns:
- a rectangle that is the bounds.
 
- 
setBoundsSets the bounds.- Parameters:
- rect- the new rectangle
 
- 
toStringReturns a string containing a concise, human-readable description of the receiver.
 
-