public class SurfaceKeyEvent extends SurfaceEvent
Modifier and Type | Field and Description |
---|---|
int |
key
The key pressed or entered by other means (grafitti input).
|
static int |
KEY_PRESS
The event type for a key press event.
|
static int |
KEY_RELEASE |
int |
modifiers
The state of the modifier keys when the event occured.
|
String |
text
This is used if a key or key-combination as pressed by the user has resulted
in the generation of a multiple character string.
|
int |
textReplacement
This is used with the MULTICHARACTER modifier.
|
Constructor and Description |
---|
SurfaceKeyEvent() |
Modifier and Type | Method and Description |
---|---|
void |
controlToLetter()
Modify this event so that control keys are modified to represent their letter counterpart.
|
static int |
getActionKey(boolean forHotKey) |
static int |
getBackKey(boolean forHotKey) |
static int |
getCancelKey(boolean forHotKey) |
int |
getLetterForControl()
The letter representing the character if it is a CTRL-
|
static boolean |
hasModifier(int key)
Checks to see if a hot-key encoded key has a modifier.
|
boolean |
isActionKey() |
boolean |
isBackKey() |
boolean |
isCancelKey() |
boolean |
isHotKey(int controlHotKey)
Checks to see if the key represented by this KeyEvent should be considered to match the hot-key of a particular Control.
|
static boolean |
isHotKey(int key,
int controlHotKey)
Checks to see if the pressed hot-key should be considered to match the hot-key of a particular Control.
|
boolean |
isMoveToNextControlKey(boolean moveForwards) |
void |
keypadToKey()
Convert a KEYPAD_ type key into a standard key.
|
int |
toKey()
Convert this KeyEvent into a hot-key encoded key code.
|
static int |
toKey(int modifier,
char character)
The produces a key code that can be used as a "Hot Key" for a Control.
|
static int |
toKey(int modifier,
int key)
The produces a key code that can be used as a "Hot Key" for a Control.
|
static String |
toString(int key)
Print a String representation of a key.
|
getSurface
clearPostData, getPostData, isReused, setPostData, setReused
_getFieldType, _getSetField, cache, compareTo, copied, copyFrom, equals, getCopy, getDeclaredField, getDeclaredFieldValue, getMyFieldList, getNew
public static final int KEY_PRESS
public static final int KEY_RELEASE
public int key
IKeys
public String text
public int textReplacement
public int modifiers
IKeys
public int getLetterForControl()
public void controlToLetter()
public void keypadToKey()
public static final String toString(int key)
key
- A key as provided in a KeyEvent.public static final int toKey(int modifier, char character)
modifier
- Any of the IKeys.SHIFT, IKeys.CONTROL, IKeys.ONLY ORed together.If none of these modifiers are used then when the character is pressed with ANY of SHIFT or CONTROL keys, the hot key will be activated. If IKeys.ONLY is specified then the character must be pressed ALONE for the hot key to be activated.
character
- The character for the key.public static final int toKey(int modifier, int key)
modifier
- Any of the IKeys.SHIFT, IKeys.CONTROL, IKeys.ONLY ORed together.If none of these modifiers are used then when the character is pressed with ANY of SHIFT or CONTROL keys, the hot key will be activated. If IKeys.ONLY is specified then the character must be pressed ALONE for the hot key to be activated.
key
- The key code for the key. You can use one of the IKeys key codes such as F1, HOME, etc.public static final boolean hasModifier(int key)
key
- The hot-key encoded key code.public static final boolean isHotKey(int key, int controlHotKey)
key
- The pressed key.controlHotKey
- The assigned hot-key of a Controlpublic final boolean isHotKey(int controlHotKey)
controlHotKey
- The assigned hot-key of a Controlpublic final int toKey()
public boolean isBackKey()
public boolean isActionKey()
public boolean isMoveToNextControlKey(boolean moveForwards)
public boolean isCancelKey()
public static int getBackKey(boolean forHotKey)
public static int getCancelKey(boolean forHotKey)
public static int getActionKey(boolean forHotKey)