public class Event
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
int |
button
the button that was pressed or released; 1 for the
first button, 2 for the second button, and 3 for the
third button, etc.
|
char |
character
depending on the event, the character represented by the key
that was typed.
|
int |
count
depending on the event type, the number of following
paint events that are pending which may always be zero
on some platforms, or the number of lines or pages to
scroll using the mouse wheel, or the number of times the
mouse has been clicked
|
java.lang.Object |
data
a field for application use
|
int |
detail
the event specific detail field, as defined by the detail constants
in class
SWT |
Display |
display
the display where the event occurred
|
boolean |
doit
depending on the event, a flag indicating whether the operation
should be allowed.
|
int |
end
depending on the event, the range of text being modified.
|
GC |
gc
the graphics context to use when painting
that is configured to use the colors, font and
damaged region of the control.
|
int |
height
the height of the bounding rectangle of the
region that requires painting
|
int |
index
the index of the item where the event occurred
|
Widget |
item
the item that the event occurred in (can be null)
|
int |
keyCode
depending on the event, the key code of the key that was typed,
as defined by the key code constants in class
SWT . |
int |
keyLocation
depending on the event, the location of key specified by the
keyCode or character.
|
double |
magnification
The change in magnification.
|
double |
rotation
The number of degrees rotated on the track pad.
|
int[] |
segments
Bidi segment offsets
|
char[] |
segmentsChars
Characters to be applied on the segment boundaries
|
int |
start
depending on the event, the range of text being modified.
|
int |
stateMask
depending on the event, the state of the keyboard modifier
keys and mouse masks at the time the event was generated.
|
java.lang.String |
text
depending on the event, the new text that will be inserted.
|
int |
time
the time that the event occurred.
|
Touch[] |
touches
An array of the touch states for the current touch event.
|
int |
type
the type of event, as defined by the event type constants
in class
SWT |
Widget |
widget
the widget that issued the event
|
int |
width
the width of the bounding rectangle of the
region that requires painting
|
int |
x
depending 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
|
int |
xDirection
If nonzero, a positive value indicates a swipe to the right,
and a negative value indicates a swipe to the left.
|
int |
y
depending 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
|
int |
yDirection
If nonzero, a positive value indicates a swipe in the up direction,
and a negative value indicates a swipe in the down direction.
|
Constructor and Description |
---|
Event() |
public Display display
public Widget widget
public int type
SWT
SWT
public int detail
SWT
SWT
public Widget item
public int index
public GC gc
public int x
public int y
public int width
public int height
public int count
public int time
public int button
public char character
public int keyCode
SWT
.
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.SWT
public int keyLocation
SWT.LEFT
, SWT.RIGHT
, SWT.KEYPAD
,
or SWT.NONE
representing the main keyboard area.
The location field can be used to differentiate key events that have the same key code and character but are generated by different keys in the keyboard. For example, a key down event with the key code equals to SWT.SHIFT can be generated by the left and the right shift keys in the keyboard. The location field can only be used to determine the location of the key code or character in the current event. It does not include information about the location of modifiers in state mask.
SWT.LEFT
,
SWT.RIGHT
,
SWT.KEYPAD
public int stateMask
SWT.MODIFIER_MASK
,
SWT.BUTTON_MASK
public int start
public int end
public java.lang.String text
public int[] segments
public char[] segmentsChars
public boolean doit
public java.lang.Object data
public Touch[] touches
public int xDirection
public int yDirection
public double magnification
public double rotation
public Rectangle getBounds()
public void setBounds(Rectangle rect)
rect
- the new rectanglepublic java.lang.String toString()
toString
in class java.lang.Object