public interface KeyListener
InputDevice.setKeyListener()
method.Modifier and Type | Field and Description |
---|---|
static int |
DOWN
Constant for the
DOWN action. |
static int |
KEY_BACKSPACE
keyCode for the backspace key, U+0008 BACKSPACE.
|
static int |
KEY_DELETE
keyCode for the delete key, U+007F DELETE.
|
static int |
KEY_DOWN
keyCode for the down key.
|
static int |
KEY_ENTER
keyCode for the enter key, U+000A LINE FEED.
|
static int |
KEY_ESCAPE
keyCode for the escape key, U+001B ESCAPE.
|
static int |
KEY_LEFT
keyCode for the left key.
|
static int |
KEY_NUM0
keyCode for ITU-T key
0 . |
static int |
KEY_NUM1
keyCode for ITU-T key
1 . |
static int |
KEY_NUM2
keyCode for ITU-T key
2 . |
static int |
KEY_NUM3
keyCode for ITU-T key
3 . |
static int |
KEY_NUM4
keyCode for ITU-T key
4 . |
static int |
KEY_NUM5
keyCode for ITU-T key
5 . |
static int |
KEY_NUM6
keyCode for ITU-T key
6 . |
static int |
KEY_NUM7
keyCode for ITU-T key
7 . |
static int |
KEY_NUM8
keyCode for ITU-T key
8 . |
static int |
KEY_NUM9
keyCode for ITU-T key
9 . |
static int |
KEY_POUND
keyCode for ITU-T key "pound" (
# ). |
static int |
KEY_RIGHT
keyCode for the right key.
|
static int |
KEY_SELECT
keyCode for the select key.
|
static int |
KEY_SPACE
keyCode for the space key, U+0020 SPACE.
|
static int |
KEY_STAR
keyCode for ITU-T key "star" (
* ). |
static int |
KEY_TAB
keyCode for the tabulation key, U+0009 HORIZONTAL TABULATION.
|
static int |
KEY_UP
keyCode for the up key.
|
static int |
LEFT
Constant for the
LEFT action. |
static int |
MODIFIER_ALT
Key modifier mask indicating the Alt key.
|
static int |
MODIFIER_CHR
Key modifier mask indicating the Chr key.
|
static int |
MODIFIER_COMMAND
Key modifier mask indicating the Command key.
|
static int |
MODIFIER_CTRL
Key modifier mask indicating the Control / Ctrl key.
|
static int |
MODIFIER_MASK
A bitmask for all key modifiers.
|
static int |
MODIFIER_SHIFT
Key modifier mask indicating the SHIFT key.
|
static int |
RIGHT
Constant for the
RIGHT action. |
static int |
UP
Constant for the
UP action. |
Modifier and Type | Method and Description |
---|---|
void |
keyPressed(InputDevice source,
int keyCode,
int keyModifier)
Called when a key is pressed.
|
void |
keyReleased(InputDevice source,
int keyCode,
int keyModifier)
Called when a key is released.
|
void |
keyRepeated(InputDevice source,
int keyCode,
int keyModifier)
Called when a key is repeated (held down).
|
static final int UP
UP
action.
Constant value 1
is set to UP
.
static final int DOWN
DOWN
action.
Constant value 6
is set to DOWN
.
static final int LEFT
LEFT
action.
Constant value 2
is set to LEFT
.
static final int RIGHT
RIGHT
action.
Constant value 5
is set to RIGHT
.
static final int KEY_NUM0
0
.
Constant value 48
is set to KEY_NUM0
.
static final int KEY_NUM1
1
.
Constant value 49
is set to KEY_NUM1
.
static final int KEY_NUM2
2
.
Constant value 50
is set to KEY_NUM2
.
static final int KEY_NUM3
3
.
Constant value 51
is set to KEY_NUM3
.
static final int KEY_NUM4
4
.
Constant value 52
is set to KEY_NUM4
.
static final int KEY_NUM5
5
.
Constant value 53
is set to KEY_NUM5
.
static final int KEY_NUM6
6
.
Constant value 54
is set to KEY_NUM6
.
static final int KEY_NUM7
7
.
Constant value 55
is set to KEY_NUM7
.
static final int KEY_NUM8
8
.
Constant value 56
is set to KEY_NUM8
.
static final int KEY_NUM9
9
.
Constant value 57
is set to KEY_NUM09
.
static final int KEY_STAR
*
).
Constant value 42
is set to KEY_STAR
.
static final int KEY_POUND
#
).
Constant value 35
is set to KEY_POUND
.
static final int KEY_UP
Constant value -1
is set to KEY_UP
.
static final int KEY_DOWN
Constant value -2
is set to KEY_DOWN
.
static final int KEY_LEFT
Constant value -3
is set to KEY_LEFT
.
static final int KEY_RIGHT
Constant value -4
is set to KEY_RIGHT
.
static final int KEY_SELECT
Constant value -5
is set to KEY_SELECT
.
static final int KEY_ENTER
Constant value 10
is set to KEY_ENTER
.
static final int KEY_SPACE
Constant value 32
is set to KEY_SPACE
.
static final int KEY_BACKSPACE
Constant value 8
is set to KEY_BACKSPACE
.
static final int KEY_DELETE
Constant value 127
is set to KEY_DELETE
.
static final int KEY_ESCAPE
Constant value 27
is set to KEY_ESCAPE
.
static final int KEY_TAB
Constant value 9
is set to KEY_TAB
.
static final int MODIFIER_ALT
static final int MODIFIER_SHIFT
static final int MODIFIER_CTRL
static final int MODIFIER_COMMAND
static final int MODIFIER_CHR
static final int MODIFIER_MASK
void keyPressed(InputDevice source, int keyCode, int keyModifier)
source
- the InputDevice
on which the key has been pressedkeyCode
- the key code of the key that was pressedkeyModifier
- the key modifier mask of the modifier key that was pressedvoid keyReleased(InputDevice source, int keyCode, int keyModifier)
source
- the InputDevice
on which the key has been releasedkeyCode
- the key code of the key that was releasedkeyModifier
- the key modifier mask of the modifier key that was releasedvoid keyRepeated(InputDevice source, int keyCode, int keyModifier)
source
- the InputDevice
on which the key has been held downkeyCode
- the key code of the key that was held downkeyModifier
- the key modifier mask of the modifier key that was held downCopyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.