Class KeyDefinition
-
- All Implemented Interfaces:
public final class KeyDefinition
-
-
Method Summary
Modifier and Type Method Description final StringgetKey()The value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout. final IntegergetKeyCode()Represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key. final IntegergetKeyCodeWithoutLocation()The key code without location, like 13, 65, 51, ... final StringgetShiftKey()The key name of the shifted key, like "KeyA", "KeyB", ... final IntegergetShiftKeyCode()The key code of the shifted key, like 65, 66, ... final StringgetText()Returns the value of the key pressed by the user. final IntegergetLocation()Returns an int representing the location of the key on the keyboard. -
-
Method Detail
-
getKey
final String getKey()
The value of the key pressed by the user, taking into consideration the state of modifier keys such as Shift as well as the keyboard locale and layout.
Examples: "a", "b", "A", "B", "1", "2", "3", "Shift", "Enter", ...
-
getKeyCode
final Integer getKeyCode()
Represents a system and implementation dependent numerical code identifying the unmodified value of the pressed key.
Note: The key code is a numeric value that represents a physical key on the keyboard. It's not the character.
Key code examples: 13, 65, 51, ...
You should avoid using this if possible; it's been deprecated for some time. Instead, you should use code if available. Codes are more reliable than key codes, because they are not affected by layout. Code example: "KeyA", "Digit3", "Enter", ...
-
getKeyCodeWithoutLocation
final Integer getKeyCodeWithoutLocation()
The key code without location, like 13, 65, 51, ...
-
getShiftKey
final String getShiftKey()
The key name of the shifted key, like "KeyA", "KeyB", ...
-
getShiftKeyCode
final Integer getShiftKeyCode()
The key code of the shifted key, like 65, 66, ...
-
getText
final String getText()
Returns the value of the key pressed by the user.
Example values: "Enter", "a", "3", ...
-
getLocation
final Integer getLocation()
Returns an int representing the location of the key on the keyboard. Example values: 0, 1, 2, 3, ...
-
-
-
-