public class KeyEvent extends Event<KeyListener>
Event.Type<H>
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_KEY_PRESS
The event type for a focus being transfered to this control
with the ENTER or ACTION keys.
|
int |
key
The key pressed or entered by other means (grafitti input).
|
static int |
KEY_PRESS
The event type for a key press event.
|
int |
modifiers
The state of the modifier keys when the event occured.
|
static int |
SPECIAL_KEY_PRESS
The event type for a device key press event.
|
Constructor and Description |
---|
KeyEvent()
Constructs a KeyEvent, assigning the type as KEY_PRESS.
|
KeyEvent(int type,
int key,
int modifiers)
Creates a new instance of KeyEvent with the specified type, key and modifiers.
|
Modifier and Type | Method and Description |
---|---|
void |
dispatch(KeyListener listener) |
boolean |
isActionKey()
Returns true if the key press is an ACTION or ENTER one.
|
boolean |
isDownKey()
Returns true if the key press is any kind of the possible ones that means Down.
|
boolean |
isNextKey()
Returns true if the key press is any kind of the possible ones that means forward
(TAB, PAGE_DOWN, DOWN, RIGHT, etc).
|
boolean |
isPrevKey()
Returns true if the key press is any kind of the possible ones that means previous
(PAGE_UP, UP, LEFT, etc)
|
boolean |
isUpKey()
Returns true if the key press is any kind of the possible ones that means UP.
|
java.lang.String |
toString() |
clearQueue, getNextAvailableEventId, isAvailable, touch
public static final int KEY_PRESS
public static final int ACTION_KEY_PRESS
public static final int SPECIAL_KEY_PRESS
public int key
SpecialKeys
public int modifiers
SpecialKeys
public KeyEvent()
public KeyEvent(int type, int key, int modifiers)
type
- the KeyEvent type, must be either KEY_PRESS
, ACTION_KEY_PRESS
or
SPECIAL_KEY_PRESS
key
- the input keymodifiers
- state of the modifier keys for this eventjava.lang.IllegalArgumentException
- if the type argument is not equal to KEY_PRESS
, ACTION_KEY_PRESS
or
SPECIAL_KEY_PRESS
.KEY_PRESS
,
ACTION_KEY_PRESS
,
SPECIAL_KEY_PRESS
public boolean isActionKey()
public boolean isUpKey()
public boolean isDownKey()
public boolean isNextKey()
public boolean isPrevKey()
public java.lang.String toString()
toString
in class Event<KeyListener>
public void dispatch(KeyListener listener)
dispatch
in class Event<KeyListener>