|
JavaTM 2 Platform Standard Ed. 6
|
上一个类
下一个类 |
框架
无框架
|
摘要: 嵌套 | 字段 | 构造方法 | 方法 |
详细信息: 字段 | 构造方法 | 方法 |
java.awt.event
类 KeyEvent
1 2 3 4 5 6 | java.lang.Object
<img src= "../../../resources/inherit.gif" alt= "继承者 " >java.util.EventObject
<img src= "../../../resources/inherit.gif" alt= "继承者 " >java.awt.AWTEvent
<img src= "../../../resources/inherit.gif" alt= "继承者 " >java.awt.event.ComponentEvent
<img src= "../../../resources/inherit.gif" alt= "继承者 " >java.awt.event.InputEvent
<img src= "../../../resources/inherit.gif" alt= "继承者 " ><b>java.awt.event.KeyEvent</b>
|
-
所有已实现的接口:
- Serializable
-
直接已知子类:
- MenuKeyEvent
-
1 | public class <b>KeyEvent</b>
|
- extends InputEvent
表示组件中发生键击的事件。
当按下、释放或键入某个键时,组件对象(如文本字段)将生成此低级别事件。该事件被传递给每一个 KeyListener
或 KeyAdapter
对象,这些对象使用组件的 addKeyListener
方法注册,以接收此类事件。(KeyAdapter
对象实现 KeyListener
接口。)发生事件时,所有此类侦听器对象都将获得此 KeyEvent
。
“键入键”事件 是高级别事件,通常不依赖于平台或键盘布局。输入 Unicode 字符时生成此类事件,它们被认为是发现字符输入的最佳方式。最简单的情况是,按下单个键(如 "a")将产生键入键事件。但是,字符经常是通过一系列按键(如‘shift’+‘a’)产生的,按下键事件和键入键事件的映射关系可能是多对一或多对多的。键释放通常不需要生成键入键事件,但在某些情况下,只有释放了某个键后才能生成键入键事件(如在 Windows 中通过 Alt-Numpad 方法来输入 ASCII 序列)。对于不生成 Unicode 字符的键是不会生成键入键事件的(如动作键、修改键等等)。
getKeyChar 方法总是返回有效的 Unicode 字符或 CHAR_UNDEFINED。KEY_TYPED 事件报告字符输入:KEY_PRESSED 和 KEY_RELEASED 事件不必与字符输入关联。因此,可以保证 getKeyChar 方法的结果只对 KEY_TYPED 事件有意义。
对于按下键和释放键事件,getKeyCode 方法返回该事件的 keyCode。对于键入键事件,getKeyCode 方法总是返回 VK_UNDEFINED。
“按下键”和“释放键”事件 是低级别事件,依赖于平台和键盘布局。只要按下或释放键就生成这些事件,它们是发现不生成字符输入的键(如动作键、修改键等等)的惟一方式。通过 getKeyCode 方法可指出按下或释放的键,该方法返回一个虚拟键码。
虚拟键码 用于报告按下了键盘上的哪个键,而不是一次或多次键击组合生成的字符(如 "A" 是由 shift + "a" 生成的)。
例如,按下 Shift 键会生成 keyCode 为 VK_SHIFT 的 KEY_PRESSED 事件,而按下 'a' 键将生成 keyCode 为 VK_A 的 KEY_PRESSED 事件。释放 'a' 键后,会激发 keyCode 为 VK_A 的 KEY_RELEASED 事件。另外,还会生成一个 keyChar 值为 'A' 的 KEY_TYPED 事件。
按下和释放键盘上的键会导致(依次)生成以下键事件:
1 2 3 | <code>KEY_PRESSED</code>
<code>KEY_TYPED</code>(只在可生成有效 Unicode 字符时产生。)
<code>KEY_RELEASED</code>
|
但在某些情况下(例如,在激活自动重复或输入方法时),该顺序可能会有所不同(并且与平台有关)。
注:
- 不产生 Unicode 字符的键组合(如 F1 和 HELP 键等动作键)不会生成 KEY_TYPED 事件。
- 并非所有键盘和系统都能够生成所有的虚拟键码。在 Java 中不会尝试人为地生成这些键。
- 虚拟键码不标识物理键:它们取决于平台和键盘布局。例如,使用美国键盘布局时生成 VK_Q 的键在使用法国键盘布局时将生成 VK_A。
- 并非所有的字符都有与之关联的 keycode。例如,没有用于问号的 keycode,因为没有在主层上显示问号的键盘。
- 为了支持平台无关的动作键处理,Java 平台为某些功能使用少量附加虚拟键常量,否则必须通过解释虚拟键码和修饰符来识别这些功能。例如,对于日文 Windows 键盘,返回 VK_ALL_CANDIDATES 而不是 VK_CONVERT 加 ALT 修饰符。
- 正如 Focus Specification 中指定的那样,默认情况下键事件被指派给焦点拥有者。
警告:除了 Java 语言定义的这些键之外(VK_ENTER、VK_BACK_SPACE 和 VK_TAB),不要依赖 VK_ 常量值。Sun 保留将来根据需要更改这些值的权利,以适应更大范围的键盘。
- 从以下版本开始:
- 1.1
- 另请参见:
-
KeyAdapter
,
KeyListener
,
Tutorial: Writing a Key Listener,
序列化表格
字段摘要 |
static char |
CHAR_UNDEFINED
KEY_PRESSED 和 KEY_RELEASED 事件没有映射到一个有效的 Unicode 字符时使用此值作为 keyChar 值。 |
static int |
KEY_FIRST
用于键事件的 id 范围的起始编号。 |
static int |
KEY_LAST
用于键事件的 id 范围的结束编号。 |
static int |
KEY_LOCATION_LEFT
该常量指示按下或释放的键位于左侧(此键的位置有多种可能性)。 |
static int |
KEY_LOCATION_NUMPAD
该常量指示按键事件发自于数字键盘或对应于数字键盘的虚拟键。 |
static int |
KEY_LOCATION_RIGHT
该常量指示按下或释放的键位于右侧(此键的位置有多种可能性)。 |
static int |
KEY_LOCATION_STANDARD
该常量指示按下或释放的键不区分左右,并且不是发自数字键盘(或者不是发自对应于数字键盘的虚拟键)。 |
static int |
KEY_LOCATION_UNKNOWN
指示 keyLocation 为不确定或不相关的常量。 |
static int |
KEY_PRESSED
“按下键”事件。 |
static int |
KEY_RELEASED
“释放键”事件。 |
static int |
KEY_TYPED
“键入键”事件。 |
static int |
VK_0
VK_0 到 VK_9 与 ASCII 的‘0’到‘9’(0x30 - 0x39) 相同 |
static int |
VK_1
|
static int |
VK_2
|
static int |
VK_3
|
static int |
VK_4
|
static int |
VK_5
|
static int |
VK_6
|
static int |
VK_7
|
static int |
VK_8
|
static int |
VK_9
|
static int |
VK_A
VK_A 到 VK_Z 与 ASCII 的‘A’到‘Z’(0x41 - 0x5A) 相同 |
static int |
VK_ACCEPT
用于 Accept 或 Commit 功能键的常量。 |
static int |
VK_ADD
|
static int |
VK_AGAIN
|
static int |
VK_ALL_CANDIDATES
用于 All Candidates 功能键的常量。 |
static int |
VK_ALPHANUMERIC
用于 Alphanumeric 功能键的常量。 |
static int |
VK_ALT
|
static int |
VK_ALT_GRAPH
用于 AltGraph 功能键的常量。 |
static int |
VK_AMPERSAND
|
static int |
VK_ASTERISK
|
static int |
VK_AT
用于 "@" 键的常量。 |
static int |
VK_B
|
static int |
VK_BACK_QUOTE
|
static int |
VK_BACK_SLASH
用于反斜杠键 "\" 的常量。 |
static int |
VK_BACK_SPACE
|
static int |
VK_BEGIN
用于 Begin 键的常量。 |
static int |
VK_BRACELEFT
|
static int |
VK_BRACERIGHT
|
static int |
VK_C
|
static int |
VK_CANCEL
|
static int |
VK_CAPS_LOCK
|
static int |
VK_CIRCUMFLEX
用于 "^" 键的常量。 |
static int |
VK_CLEAR
|
static int |
VK_CLOSE_BRACKET
用于右方括号键 "]" 的常量。 |
static int |
VK_CODE_INPUT
用于 Code Input 功能键的常量。 |
static int |
VK_COLON
用于 ":" 键的常量。 |
static int |
VK_COMMA
用于逗号键 "," 的常量。 |
static int |
VK_COMPOSE
用于 Compose 功能键的常量。 |
static int |
VK_CONTEXT_MENU
用于 Microsoft Windows 上下文菜单键的常量。 |
static int |
VK_CONTROL
|
static int |
VK_CONVERT
用于 Convert 功能键的常量。 |
static int |
VK_COPY
|
static int |
VK_CUT
|
static int |
VK_D
|
static int |
VK_DEAD_ABOVEDOT
|
static int |
VK_DEAD_ABOVERING
|
static int |
VK_DEAD_ACUTE
|
static int |
VK_DEAD_BREVE
|
static int |
VK_DEAD_CARON
|
static int |
VK_DEAD_CEDILLA
|
static int |
VK_DEAD_CIRCUMFLEX
|
static int |
VK_DEAD_DIAERESIS
|
static int |
VK_DEAD_DOUBLEACUTE
|
static int |
VK_DEAD_GRAVE
|
static int |
VK_DEAD_IOTA
|
static int |
VK_DEAD_MACRON
|
static int |
VK_DEAD_OGONEK
|
static int |
VK_DEAD_SEMIVOICED_SOUND
|
static int |
VK_DEAD_TILDE
|
static int |
VK_DEAD_VOICED_SOUND
|
static int |
VK_DECIMAL
|
static int |
VK_DELETE
|
static int |
VK_DIVIDE
|
static int |
VK_DOLLAR
用于 "$" 键的常量。 |
static int |
VK_DOWN
用于非数字键盘向下方向键的常量。 |
static int |
VK_E
|
static int |
VK_END
|
static int |
VK_ENTER
|
static int |
VK_EQUALS
用于等号键 "=" 的常量。 |
static int |
VK_ESCAPE
|
static int |
VK_EURO_SIGN
用于欧洲货币符号键的常量。 |
static int |
VK_EXCLAMATION_MARK
用于 "!" 键的常量。 |
static int |
VK_F
|
static int |
VK_F1
用于 F1 功能键的常量。 |
static int |
VK_F10
用于 F10 功能键的常量。 |
static int |
VK_F11
用于 F11 功能键的常量。 |
static int |
VK_F12
用于 F12 功能键的常量。 |
static int |
VK_F13
用于 F13 功能键的常量。 |
static int |
VK_F14
用于 F14 功能键的常量。 |
static int |
VK_F15
用于 F15 功能键的常量。 |
static int |
VK_F16
用于 F16 功能键的常量。 |
static int |
VK_F17
用于 F17 功能键的常量。 |
static int |
VK_F18
用于 F18 功能键的常量。 |
static int |
VK_F19
用于 F19 功能键的常量。 |
static int |
VK_F2
用于 F2 功能键的常量。 |
static int |
VK_F20
用于 F20 功能键的常量。 |
static int |
VK_F21
用于 F21 功能键的常量。 |
static int |
VK_F22
用于 F22 功能键的常量。 |
static int |
VK_F23
用于 F23 功能键的常量。 |
static int |
VK_F24
用于 F24 功能键的常量。 |
static int |
VK_F3
用于 F3 功能键的常量。 |
static int |
VK_F4
用于 F4 功能键的常量。 |
static int |
VK_F5
用于 F5 功能键的常量。 |
static int |
VK_F6
用于 F6 功能键的常量。 |
static int |
VK_F7
用于 F7 功能键的常量。 |
static int |
VK_F8
用于 F8 功能键的常量。 |
static int |
VK_F9
用于 F9 功能键的常量。 |
static int |
VK_FINAL
|
static int |
VK_FIND
|
static int |
VK_FULL_WIDTH
用于 Full-Width Characters 功能键的常量。 |
static int |
VK_G
|
static int |
VK_GREATER
|
static int |
VK_H
|
static int |
VK_HALF_WIDTH
用于 Half-Width Characters 功能键的常量。 |
static int |
VK_HELP
|
static int |
VK_HIRAGANA
用于 Hiragana 功能键的常量。 |
static int |
VK_HOME
|
static int |
VK_I
|
static int |
VK_INPUT_METHOD_ON_OFF
用于输入法开/关键的常量。 |
static int |
VK_INSERT
|
static int |
VK_INVERTED_EXCLAMATION_MARK
用于反向感叹号键的常量。 |
static int |
VK_J
|
static int |
VK_JAPANESE_HIRAGANA
用于 Japanese-Hiragana 功能键的常量。 |
static int |
VK_JAPANESE_KATAKANA
用于 Japanese-Katakana 功能键的常量。 |
static int |
VK_JAPANESE_ROMAN
用于 Japanese-Roman 功能键的常量。 |
static int |
VK_K
|
static int |
VK_KANA
|
static int |
VK_KANA_LOCK
用于锁定 Kana 功能键的常量。 |
static int |
VK_KANJI
|
static int |
VK_KATAKANA
用于 Katakana 功能键的常量。 |
static int |
VK_KP_DOWN
用于数字键盘向下方向键的常量。 |
static int |
VK_KP_LEFT
用于数字键盘向左方向键的常量。 |
static int |
VK_KP_RIGHT
用于数字键盘向右方向键的常量。 |
static int |
VK_KP_UP
用于数字键盘向上方向键的常量。 |
static int |
VK_L
|
static int |
VK_LEFT
用于非数字键盘向左方向键的常量。 |
static int |
VK_LEFT_PARENTHESIS
用于 "(" 键的常量。 |
static int |
VK_LESS
|
static int |
VK_M
|
static int |
VK_META
|
static int |
VK_MINUS
用于减号键 "-" 的常量 |
static int |
VK_MODECHANGE
|
static int |
VK_MULTIPLY
|
static int |
VK_N
|
static int |
VK_NONCONVERT
用于 Don't Convert 功能键的常量。 |
static int |
VK_NUM_LOCK
|
static int |
VK_NUMBER_SIGN
用于 "#" 键的常量。 |
static int |
VK_NUMPAD0
|
static int |
VK_NUMPAD1
|
static int |
VK_NUMPAD2
|
static int |
VK_NUMPAD3
|
static int |
VK_NUMPAD4
|
static int |
VK_NUMPAD5
|
static int |
VK_NUMPAD6
|
static int |
VK_NUMPAD7
|
static int |
VK_NUMPAD8
|
static int |
VK_NUMPAD9
|
static int |
VK_O
|
static int |
VK_OPEN_BRACKET
用于左方括号键 "[" 的常量。 |
static int |
VK_P
|
static int |
VK_PAGE_DOWN
|
static int |
VK_PAGE_UP
|
static int |
VK_PASTE
|
static int |
VK_PAUSE
|
static int |
VK_PERIOD
用于句点键 "." 的常量。 |
static int |
VK_PLUS
用于 "+" 键的常量。 |
static int |
VK_PREVIOUS_CANDIDATE
用于 Previous Candidate 功能键的常量。 |
static int |
VK_PRINTSCREEN
|
static int |
VK_PROPS
|
static int |
VK_Q
|
static int |
VK_QUOTE
|
static int |
VK_QUOTEDBL
|
static int |
VK_R
|
static int |
VK_RIGHT
用于非数字键盘向右方向键的常量。 |
static int |
VK_RIGHT_PARENTHESIS
用于 ")" 键的常量。 |
static int |
VK_ROMAN_CHARACTERS
用于 Roman Characters 功能键的常量。 |
static int |
VK_S
|
static int |
VK_SCROLL_LOCK
|
static int |
VK_SEMICOLON
用于分号键 ";" 的常量。 |
static int |
VK_SEPARATER
此常量已废弃,包括它仅为了向后兼容。 |
static int |
VK_SEPARATOR
用于数字键盘分隔符键的常量。 |
static int |
VK_SHIFT
|
static int |
VK_SLASH
用于正斜杠键 "/" 的常量。 |
static int |
VK_SPACE
|
static int |
VK_STOP
|
static int |
VK_SUBTRACT
|
static int |
VK_T
|
static int |
VK_TAB
|
static int |
VK_U
|
static int |
VK_UNDEFINED
此值用于指出 keyCode 是未知的。 |
static int |
VK_UNDERSCORE
用于 "_" 键的常量。 |
static int |
VK_UNDO
|
static int |
VK_UP
用于非数字键盘向上方向键的常量。 |
static int |
VK_V
|
static int |
VK_W
|
static int |
VK_WINDOWS
用于 Microsoft Windows 的 "Windows" 键的常量。 |
static int |
VK_X
|
static int |
VK_Y
|
static int |
VK_Z
|
从类 java.awt.event.InputEvent 继承的字段 |
ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK |
从类 java.awt.event.ComponentEvent 继承的字段 |
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN |
从类 java.awt.AWTEvent 继承的字段 |
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK |
从类 java.util.EventObject 继承的字段 |
source |
构造方法摘要 |
KeyEvent(Component source,
int id,
long when,
int modifiers,
int keyCode)
已过时。 从 JDK1.1 开始
|
KeyEvent(Component source,
int id,
long when,
int modifiers,
int keyCode,
char keyChar)
构造一个 KeyEvent 对象。 |
KeyEvent(Component source,
int id,
long when,
int modifiers,
int keyCode,
char keyChar,
int keyLocation)
|
方法摘要 |
char |
getKeyChar()
返回与此事件中的键关联的字符。 |
int |
getKeyCode()
返回与此事件中的键关联的整数 keyCode。 |
int |
getKeyLocation()
返回产生此按键事件的键位置。 |
static String |
getKeyModifiersText(int modifiers)
返回描述修改键的 String ,如 "Shift" 或 "Ctrl+Shift"。 |
static String |
getKeyText(int keyCode)
返回描述 keyCode 的 String,如 "HOME"、"F1" 或 "A"。 |
boolean |
isActionKey()
返回此事件中的键是否为“动作”键。 |
String |
paramString()
返回标识此事件的参数字符串。 |
void |
setKeyChar(char keyChar)
设置 keyCode 值,以表示某个逻辑字符。 |
void |
setKeyCode(int keyCode)
设置 keyCode 值,以表示某个物理键。 |
void |
setModifiers(int modifiers)
已过时。 从 JDK1.1.4 开始
|
从类 java.awt.event.InputEvent 继承的方法 |
consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown |
从类 java.awt.event.ComponentEvent 继承的方法 |
getComponent |
从类 java.awt.AWTEvent 继承的方法 |
getID, setSource, toString |
从类 java.util.EventObject 继承的方法 |
getSource |
从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
KEY_FIRST
1 | public static final int <b>KEY_FIRST</b>
|
- 用于键事件的 id 范围的起始编号。
- 另请参见:
- 常量字段值
KEY_LAST
1 | public static final int <b>KEY_LAST</b>
|
- 用于键事件的 id 范围的结束编号。
- 另请参见:
- 常量字段值
KEY_TYPED
1 | public static final int <b>KEY_TYPED</b>
|
- “键入键”事件。输入字符时生成此事件。最简单的情况是,按下单个键产生该事件。但是,经常是通过一系列按键来产生字符,按下键事件和键入键事件的映射关系可能是多对一或多对多的。
- 另请参见:
- 常量字段值
KEY_PRESSED
1 | public static final int <b>KEY_PRESSED</b>
|
- “按下键”事件。键被按下时生成此事件。
- 另请参见:
- 常量字段值
KEY_RELEASED
1 | public static final int <b>KEY_RELEASED</b>
|
- “释放键”事件。松开键时生成此事件。
- 另请参见:
- 常量字段值
VK_ENTER
1 | public static final int <b>VK_ENTER</b>
|
- 另请参见:
- 常量字段值
VK_BACK_SPACE
1 | public static final int <b>VK_BACK_SPACE</b>
|
- 另请参见:
- 常量字段值
VK_TAB
1 | public static final int <b>VK_TAB</b>
|
- 另请参见:
- 常量字段值
VK_CANCEL
1 | public static final int <b>VK_CANCEL</b>
|
- 另请参见:
- 常量字段值
VK_CLEAR
1 | public static final int <b>VK_CLEAR</b>
|
- 另请参见:
- 常量字段值
VK_SHIFT
1 | public static final int <b>VK_SHIFT</b>
|
- 另请参见:
- 常量字段值
VK_CONTROL
1 | public static final int <b>VK_CONTROL</b>
|
- 另请参见:
- 常量字段值
VK_ALT
1 | public static final int <b>VK_ALT</b>
|
- 另请参见:
- 常量字段值
VK_PAUSE
1 | public static final int <b>VK_PAUSE</b>
|
- 另请参见:
- 常量字段值
VK_CAPS_LOCK
1 | public static final int <b>VK_CAPS_LOCK</b>
|
- 另请参见:
- 常量字段值
VK_ESCAPE
1 | public static final int <b>VK_ESCAPE</b>
|
- 另请参见:
- 常量字段值
VK_SPACE
1 | public static final int <b>VK_SPACE</b>
|
- 另请参见:
- 常量字段值
VK_PAGE_UP
1 | public static final int <b>VK_PAGE_UP</b>
|
- 另请参见:
- 常量字段值
VK_PAGE_DOWN
1 | public static final int <b>VK_PAGE_DOWN</b>
|
- 另请参见:
- 常量字段值
VK_END
1 | public static final int <b>VK_END</b>
|
- 另请参见:
- 常量字段值
VK_HOME
1 | public static final int <b>VK_HOME</b>
|
- 另请参见:
- 常量字段值
VK_LEFT
1 | public static final int <b>VK_LEFT</b>
|
- 用于非数字键盘向左方向键的常量。
- 另请参见:
-
VK_KP_LEFT
,
常量字段值
VK_UP
1 | public static final int <b>VK_UP</b>
|
- 用于非数字键盘向上方向键的常量。
- 另请参见:
-
VK_KP_UP
,
常量字段值
VK_RIGHT
1 | public static final int <b>VK_RIGHT</b>
|
- 用于非数字键盘向右方向键的常量。
- 另请参见:
-
VK_KP_RIGHT
,
常量字段值
VK_DOWN
1 | public static final int <b>VK_DOWN</b>
|
- 用于非数字键盘向下方向键的常量。
- 另请参见:
-
VK_KP_DOWN
,
常量字段值
VK_COMMA
1 | public static final int <b>VK_COMMA</b>
|
- 用于逗号键 "," 的常量。
- 另请参见:
- 常量字段值
VK_MINUS
1 | public static final int <b>VK_MINUS</b>
|
- 用于减号键 "-" 的常量
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PERIOD
1 | public static final int <b>VK_PERIOD</b>
|
- 用于句点键 "." 的常量。
- 另请参见:
- 常量字段值
VK_SLASH
1 | public static final int <b>VK_SLASH</b>
|
- 用于正斜杠键 "/" 的常量。
- 另请参见:
- 常量字段值
VK_0
1 | public static final int <b>VK_0</b>
|
- VK_0 到 VK_9 与 ASCII 的‘0’到‘9’(0x30 - 0x39) 相同
- 另请参见:
- 常量字段值
VK_1
1 | public static final int <b>VK_1</b>
|
- 另请参见:
- 常量字段值
VK_2
1 | public static final int <b>VK_2</b>
|
- 另请参见:
- 常量字段值
VK_3
1 | public static final int <b>VK_3</b>
|
- 另请参见:
- 常量字段值
VK_4
1 | public static final int <b>VK_4</b>
|
- 另请参见:
- 常量字段值
VK_5
1 | public static final int <b>VK_5</b>
|
- 另请参见:
- 常量字段值
VK_6
1 | public static final int <b>VK_6</b>
|
- 另请参见:
- 常量字段值
VK_7
1 | public static final int <b>VK_7</b>
|
- 另请参见:
- 常量字段值
VK_8
1 | public static final int <b>VK_8</b>
|
- 另请参见:
- 常量字段值
VK_9
1 | public static final int <b>VK_9</b>
|
- 另请参见:
- 常量字段值
VK_SEMICOLON
1 | public static final int <b>VK_SEMICOLON</b>
|
- 用于分号键 ";" 的常量。
- 另请参见:
- 常量字段值
VK_EQUALS
1 | public static final int <b>VK_EQUALS</b>
|
- 用于等号键 "=" 的常量。
- 另请参见:
- 常量字段值
VK_A
1 | public static final int <b>VK_A</b>
|
- VK_A 到 VK_Z 与 ASCII 的‘A’到‘Z’(0x41 - 0x5A) 相同
- 另请参见:
- 常量字段值
VK_B
1 | public static final int <b>VK_B</b>
|
- 另请参见:
- 常量字段值
VK_C
1 | public static final int <b>VK_C</b>
|
- 另请参见:
- 常量字段值
VK_D
1 | public static final int <b>VK_D</b>
|
- 另请参见:
- 常量字段值
VK_E
1 | public static final int <b>VK_E</b>
|
- 另请参见:
- 常量字段值
VK_F
1 | public static final int <b>VK_F</b>
|
- 另请参见:
- 常量字段值
VK_G
1 | public static final int <b>VK_G</b>
|
- 另请参见:
- 常量字段值
VK_H
1 | public static final int <b>VK_H</b>
|
- 另请参见:
- 常量字段值
VK_I
1 | public static final int <b>VK_I</b>
|
- 另请参见:
- 常量字段值
VK_J
1 | public static final int <b>VK_J</b>
|
- 另请参见:
- 常量字段值
VK_K
1 | public static final int <b>VK_K</b>
|
- 另请参见:
- 常量字段值
VK_L
1 | public static final int <b>VK_L</b>
|
- 另请参见:
- 常量字段值
VK_M
1 | public static final int <b>VK_M</b>
|
- 另请参见:
- 常量字段值
VK_N
1 | public static final int <b>VK_N</b>
|
- 另请参见:
- 常量字段值
VK_O
1 | public static final int <b>VK_O</b>
|
- 另请参见:
- 常量字段值
VK_P
1 | public static final int <b>VK_P</b>
|
- 另请参见:
- 常量字段值
VK_Q
1 | public static final int <b>VK_Q</b>
|
- 另请参见:
- 常量字段值
VK_R
1 | public static final int <b>VK_R</b>
|
- 另请参见:
- 常量字段值
VK_S
1 | public static final int <b>VK_S</b>
|
- 另请参见:
- 常量字段值
VK_T
1 | public static final int <b>VK_T</b>
|
- 另请参见:
- 常量字段值
VK_U
1 | public static final int <b>VK_U</b>
|
- 另请参见:
- 常量字段值
VK_V
1 | public static final int <b>VK_V</b>
|
- 另请参见:
- 常量字段值
VK_W
1 | public static final int <b>VK_W</b>
|
- 另请参见:
- 常量字段值
VK_X
1 | public static final int <b>VK_X</b>
|
- 另请参见:
- 常量字段值
VK_Y
1 | public static final int <b>VK_Y</b>
|
- 另请参见:
- 常量字段值
VK_Z
1 | public static final int <b>VK_Z</b>
|
- 另请参见:
- 常量字段值
VK_OPEN_BRACKET
1 | public static final int <b>VK_OPEN_BRACKET</b>
|
- 用于左方括号键 "[" 的常量。
- 另请参见:
- 常量字段值
VK_BACK_SLASH
1 | public static final int <b>VK_BACK_SLASH</b>
|
- 用于反斜杠键 "\" 的常量。
- 另请参见:
- 常量字段值
VK_CLOSE_BRACKET
1 | public static final int <b>VK_CLOSE_BRACKET</b>
|
- 用于右方括号键 "]" 的常量。
- 另请参见:
- 常量字段值
VK_NUMPAD0
1 | public static final int <b>VK_NUMPAD0</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD1
1 | public static final int <b>VK_NUMPAD1</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD2
1 | public static final int <b>VK_NUMPAD2</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD3
1 | public static final int <b>VK_NUMPAD3</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD4
1 | public static final int <b>VK_NUMPAD4</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD5
1 | public static final int <b>VK_NUMPAD5</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD6
1 | public static final int <b>VK_NUMPAD6</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD7
1 | public static final int <b>VK_NUMPAD7</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD8
1 | public static final int <b>VK_NUMPAD8</b>
|
- 另请参见:
- 常量字段值
VK_NUMPAD9
1 | public static final int <b>VK_NUMPAD9</b>
|
- 另请参见:
- 常量字段值
VK_MULTIPLY
1 | public static final int <b>VK_MULTIPLY</b>
|
- 另请参见:
- 常量字段值
VK_ADD
1 | public static final int <b>VK_ADD</b>
|
- 另请参见:
- 常量字段值
VK_SEPARATER
1 | public static final int <b>VK_SEPARATER</b>
|
- 此常量已废弃,包括它仅为了向后兼容。
- 另请参见:
-
VK_SEPARATOR
,
常量字段值
VK_SEPARATOR
1 | public static final int <b>VK_SEPARATOR</b>
|
- 用于数字键盘分隔符键的常量。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
VK_SUBTRACT
1 | public static final int <b>VK_SUBTRACT</b>
|
- 另请参见:
- 常量字段值
VK_DECIMAL
1 | public static final int <b>VK_DECIMAL</b>
|
- 另请参见:
- 常量字段值
VK_DIVIDE
1 | public static final int <b>VK_DIVIDE</b>
|
- 另请参见:
- 常量字段值
VK_DELETE
1 | public static final int <b>VK_DELETE</b>
|
- 另请参见:
- 常量字段值
VK_NUM_LOCK
1 | public static final int <b>VK_NUM_LOCK</b>
|
- 另请参见:
- 常量字段值
VK_SCROLL_LOCK
1 | public static final int <b>VK_SCROLL_LOCK</b>
|
- 另请参见:
- 常量字段值
VK_F1
1 | public static final int <b>VK_F1</b>
|
- 用于 F1 功能键的常量。
- 另请参见:
- 常量字段值
VK_F2
1 | public static final int <b>VK_F2</b>
|
- 用于 F2 功能键的常量。
- 另请参见:
- 常量字段值
VK_F3
1 | public static final int <b>VK_F3</b>
|
- 用于 F3 功能键的常量。
- 另请参见:
- 常量字段值
VK_F4
1 | public static final int <b>VK_F4</b>
|
- 用于 F4 功能键的常量。
- 另请参见:
- 常量字段值
VK_F5
1 | public static final int <b>VK_F5</b>
|
- 用于 F5 功能键的常量。
- 另请参见:
- 常量字段值
VK_F6
1 | public static final int <b>VK_F6</b>
|
- 用于 F6 功能键的常量。
- 另请参见:
- 常量字段值
VK_F7
1 | public static final int <b>VK_F7</b>
|
- 用于 F7 功能键的常量。
- 另请参见:
- 常量字段值
VK_F8
1 | public static final int <b>VK_F8</b>
|
- 用于 F8 功能键的常量。
- 另请参见:
- 常量字段值
VK_F9
1 | public static final int <b>VK_F9</b>
|
- 用于 F9 功能键的常量。
- 另请参见:
- 常量字段值
VK_F10
1 | public static final int <b>VK_F10</b>
|
- 用于 F10 功能键的常量。
- 另请参见:
- 常量字段值
VK_F11
1 | public static final int <b>VK_F11</b>
|
- 用于 F11 功能键的常量。
- 另请参见:
- 常量字段值
VK_F12
1 | public static final int <b>VK_F12</b>
|
- 用于 F12 功能键的常量。
- 另请参见:
- 常量字段值
VK_F13
1 | public static final int <b>VK_F13</b>
|
- 用于 F13 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F14
1 | public static final int <b>VK_F14</b>
|
- 用于 F14 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F15
1 | public static final int <b>VK_F15</b>
|
- 用于 F15 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F16
1 | public static final int <b>VK_F16</b>
|
- 用于 F16 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F17
1 | public static final int <b>VK_F17</b>
|
- 用于 F17 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F18
1 | public static final int <b>VK_F18</b>
|
- 用于 F18 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F19
1 | public static final int <b>VK_F19</b>
|
- 用于 F19 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F20
1 | public static final int <b>VK_F20</b>
|
- 用于 F20 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F21
1 | public static final int <b>VK_F21</b>
|
- 用于 F21 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F22
1 | public static final int <b>VK_F22</b>
|
- 用于 F22 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F23
1 | public static final int <b>VK_F23</b>
|
- 用于 F23 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_F24
1 | public static final int <b>VK_F24</b>
|
- 用于 F24 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PRINTSCREEN
1 | public static final int <b>VK_PRINTSCREEN</b>
|
- 另请参见:
- 常量字段值
VK_INSERT
1 | public static final int <b>VK_INSERT</b>
|
- 另请参见:
- 常量字段值
VK_HELP
1 | public static final int <b>VK_HELP</b>
|
- 另请参见:
- 常量字段值
VK_META
1 | public static final int <b>VK_META</b>
|
- 另请参见:
- 常量字段值
VK_BACK_QUOTE
1 | public static final int <b>VK_BACK_QUOTE</b>
|
- 另请参见:
- 常量字段值
VK_QUOTE
1 | public static final int <b>VK_QUOTE</b>
|
- 另请参见:
- 常量字段值
VK_KP_UP
1 | public static final int <b>VK_KP_UP</b>
|
- 用于数字键盘向上方向键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
-
VK_UP
,
常量字段值
VK_KP_DOWN
1 | public static final int <b>VK_KP_DOWN</b>
|
- 用于数字键盘向下方向键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
-
VK_DOWN
,
常量字段值
VK_KP_LEFT
1 | public static final int <b>VK_KP_LEFT</b>
|
- 用于数字键盘向左方向键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
-
VK_LEFT
,
常量字段值
VK_KP_RIGHT
1 | public static final int <b>VK_KP_RIGHT</b>
|
- 用于数字键盘向右方向键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
-
VK_RIGHT
,
常量字段值
VK_DEAD_GRAVE
1 | public static final int <b>VK_DEAD_GRAVE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_ACUTE
1 | public static final int <b>VK_DEAD_ACUTE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_CIRCUMFLEX
1 | public static final int <b>VK_DEAD_CIRCUMFLEX</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_TILDE
1 | public static final int <b>VK_DEAD_TILDE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_MACRON
1 | public static final int <b>VK_DEAD_MACRON</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_BREVE
1 | public static final int <b>VK_DEAD_BREVE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_ABOVEDOT
1 | public static final int <b>VK_DEAD_ABOVEDOT</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_DIAERESIS
1 | public static final int <b>VK_DEAD_DIAERESIS</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_ABOVERING
1 | public static final int <b>VK_DEAD_ABOVERING</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_DOUBLEACUTE
1 | public static final int <b>VK_DEAD_DOUBLEACUTE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_CARON
1 | public static final int <b>VK_DEAD_CARON</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_CEDILLA
1 | public static final int <b>VK_DEAD_CEDILLA</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_OGONEK
1 | public static final int <b>VK_DEAD_OGONEK</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_IOTA
1 | public static final int <b>VK_DEAD_IOTA</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_VOICED_SOUND
1 | public static final int <b>VK_DEAD_VOICED_SOUND</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DEAD_SEMIVOICED_SOUND
1 | public static final int <b>VK_DEAD_SEMIVOICED_SOUND</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_AMPERSAND
1 | public static final int <b>VK_AMPERSAND</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_ASTERISK
1 | public static final int <b>VK_ASTERISK</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_QUOTEDBL
1 | public static final int <b>VK_QUOTEDBL</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_LESS
1 | public static final int <b>VK_LESS</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_GREATER
1 | public static final int <b>VK_GREATER</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_BRACELEFT
1 | public static final int <b>VK_BRACELEFT</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_BRACERIGHT
1 | public static final int <b>VK_BRACERIGHT</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_AT
1 | public static final int <b>VK_AT</b>
|
- 用于 "@" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_COLON
1 | public static final int <b>VK_COLON</b>
|
- 用于 ":" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_CIRCUMFLEX
1 | public static final int <b>VK_CIRCUMFLEX</b>
|
- 用于 "^" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_DOLLAR
1 | public static final int <b>VK_DOLLAR</b>
|
- 用于 "$" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_EURO_SIGN
1 | public static final int <b>VK_EURO_SIGN</b>
|
- 用于欧洲货币符号键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_EXCLAMATION_MARK
1 | public static final int <b>VK_EXCLAMATION_MARK</b>
|
- 用于 "!" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_INVERTED_EXCLAMATION_MARK
1 | public static final int <b>VK_INVERTED_EXCLAMATION_MARK</b>
|
- 用于反向感叹号键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_LEFT_PARENTHESIS
1 | public static final int <b>VK_LEFT_PARENTHESIS</b>
|
- 用于 "(" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_NUMBER_SIGN
1 | public static final int <b>VK_NUMBER_SIGN</b>
|
- 用于 "#" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PLUS
1 | public static final int <b>VK_PLUS</b>
|
- 用于 "+" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_RIGHT_PARENTHESIS
1 | public static final int <b>VK_RIGHT_PARENTHESIS</b>
|
- 用于 ")" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_UNDERSCORE
1 | public static final int <b>VK_UNDERSCORE</b>
|
- 用于 "_" 键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_WINDOWS
1 | public static final int <b>VK_WINDOWS</b>
|
- 用于 Microsoft Windows 的 "Windows" 键的常量。此常量同时用于左右两个这种键。
- 从以下版本开始:
- 1.5
- 另请参见:
-
getKeyLocation()
,
常量字段值
VK_CONTEXT_MENU
1 | public static final int <b>VK_CONTEXT_MENU</b>
|
- 用于 Microsoft Windows 上下文菜单键的常量。
- 从以下版本开始:
- 1.5
- 另请参见:
- 常量字段值
VK_FINAL
1 | public static final int <b>VK_FINAL</b>
|
- 另请参见:
- 常量字段值
VK_CONVERT
1 | public static final int <b>VK_CONVERT</b>
|
- 用于 Convert 功能键的常量。
- 另请参见:
- 常量字段值
VK_NONCONVERT
1 | public static final int <b>VK_NONCONVERT</b>
|
- 用于 Don't Convert 功能键的常量。
- 另请参见:
- 常量字段值
VK_ACCEPT
1 | public static final int <b>VK_ACCEPT</b>
|
- 用于 Accept 或 Commit 功能键的常量。
- 另请参见:
- 常量字段值
VK_MODECHANGE
1 | public static final int <b>VK_MODECHANGE</b>
|
- 另请参见:
- 常量字段值
VK_KANA
1 | public static final int <b>VK_KANA</b>
|
- 另请参见:
- 常量字段值
VK_KANJI
1 | public static final int <b>VK_KANJI</b>
|
- 另请参见:
- 常量字段值
VK_ALPHANUMERIC
1 | public static final int <b>VK_ALPHANUMERIC</b>
|
- 用于 Alphanumeric 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_KATAKANA
1 | public static final int <b>VK_KATAKANA</b>
|
- 用于 Katakana 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_HIRAGANA
1 | public static final int <b>VK_HIRAGANA</b>
|
- 用于 Hiragana 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_FULL_WIDTH
1 | public static final int <b>VK_FULL_WIDTH</b>
|
- 用于 Full-Width Characters 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_HALF_WIDTH
1 | public static final int <b>VK_HALF_WIDTH</b>
|
- 用于 Half-Width Characters 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_ROMAN_CHARACTERS
1 | public static final int <b>VK_ROMAN_CHARACTERS</b>
|
- 用于 Roman Characters 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_ALL_CANDIDATES
1 | public static final int <b>VK_ALL_CANDIDATES</b>
|
- 用于 All Candidates 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PREVIOUS_CANDIDATE
1 | public static final int <b>VK_PREVIOUS_CANDIDATE</b>
|
- 用于 Previous Candidate 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_CODE_INPUT
1 | public static final int <b>VK_CODE_INPUT</b>
|
- 用于 Code Input 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_JAPANESE_KATAKANA
1 | public static final int <b>VK_JAPANESE_KATAKANA</b>
|
- 用于 Japanese-Katakana 功能键的常量。此键可切换到日文输入法并选择其 Katakana 输入模式。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_JAPANESE_HIRAGANA
1 | public static final int <b>VK_JAPANESE_HIRAGANA</b>
|
- 用于 Japanese-Hiragana 功能键的常量。此键可切换到日文输入法并选择其 Hiragana 输入模式。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_JAPANESE_ROMAN
1 | public static final int <b>VK_JAPANESE_ROMAN</b>
|
- 用于 Japanese-Roman 功能键的常量。此键可切换到日文输入法并选择其 Roman-Direct 输入模式。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_KANA_LOCK
1 | public static final int <b>VK_KANA_LOCK</b>
|
- 用于锁定 Kana 功能键的常量。这将把键盘锁定在 Kana 布局。
- 从以下版本开始:
- 1.3
- 另请参见:
- 常量字段值
VK_INPUT_METHOD_ON_OFF
1 | public static final int <b>VK_INPUT_METHOD_ON_OFF</b>
|
- 用于输入法开/关键的常量。
- 从以下版本开始:
- 1.3
- 另请参见:
- 常量字段值
VK_CUT
1 | public static final int <b>VK_CUT</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_COPY
1 | public static final int <b>VK_COPY</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PASTE
1 | public static final int <b>VK_PASTE</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_UNDO
1 | public static final int <b>VK_UNDO</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_AGAIN
1 | public static final int <b>VK_AGAIN</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_FIND
1 | public static final int <b>VK_FIND</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_PROPS
1 | public static final int <b>VK_PROPS</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_STOP
1 | public static final int <b>VK_STOP</b>
|
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_COMPOSE
1 | public static final int <b>VK_COMPOSE</b>
|
- 用于 Compose 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_ALT_GRAPH
1 | public static final int <b>VK_ALT_GRAPH</b>
|
- 用于 AltGraph 功能键的常量。
- 从以下版本开始:
- 1.2
- 另请参见:
- 常量字段值
VK_BEGIN
1 | public static final int <b>VK_BEGIN</b>
|
- 用于 Begin 键的常量。
- 从以下版本开始:
- 1.5
- 另请参见:
- 常量字段值
VK_UNDEFINED
1 | public static final int <b>VK_UNDEFINED</b>
|
- 此值用于指出 keyCode 是未知的。KEY_TYPED 事件没有 keyCode 值,用此值代替。
- 另请参见:
- 常量字段值
CHAR_UNDEFINED
1 | public static final char <b>CHAR_UNDEFINED</b>
|
- KEY_PRESSED 和 KEY_RELEASED 事件没有映射到一个有效的 Unicode 字符时使用此值作为 keyChar 值。
- 另请参见:
- 常量字段值
KEY_LOCATION_UNKNOWN
1 | public static final int <b>KEY_LOCATION_UNKNOWN</b>
|
- 指示 keyLocation 为不确定或不相关的常量。
KEY_TYPED
事件没有 keyLocation,使用此值代替。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
KEY_LOCATION_STANDARD
1 | public static final int <b>KEY_LOCATION_STANDARD</b>
|
- 该常量指示按下或释放的键不区分左右,并且不是发自数字键盘(或者不是发自对应于数字键盘的虚拟键)。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
KEY_LOCATION_LEFT
1 | public static final int <b>KEY_LOCATION_LEFT</b>
|
- 该常量指示按下或释放的键位于左侧(此键的位置有多种可能性)。示例:左侧的 shift 键。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
KEY_LOCATION_RIGHT
1 | public static final int <b>KEY_LOCATION_RIGHT</b>
|
- 该常量指示按下或释放的键位于右侧(此键的位置有多种可能性)。示例:右侧的 shift 键。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
KEY_LOCATION_NUMPAD
1 | public static final int <b>KEY_LOCATION_NUMPAD</b>
|
- 该常量指示按键事件发自于数字键盘或对应于数字键盘的虚拟键。
- 从以下版本开始:
- 1.4
- 另请参见:
- 常量字段值
KeyEvent
1 2 3 4 5 6 7 | public <b>KeyEvent</b>(Component source,
int id,
long when,
int modifiers,
int keyCode,
char keyChar,
int keyLocation)
|
KeyEvent
1 2 3 4 5 6 | public <b>KeyEvent</b>(Component source,
int id,
long when,
int modifiers,
int keyCode,
char keyChar)
|
- 构造一个
KeyEvent
对象。
注意,传入无效的 id
将导致不明确的行为。如果 source
为 null
,则此方法抛出 IllegalArgumentException
。
- 参数:
-
source
- 产生事件的 Component
-
id
- 标识事件类型的整数 -
when
- 指定事件发生时间的 long 型整数 -
modifiers
- 事件期间按下的修改键(shift、ctrl、alt、meta)。应该使用扩展的 _DOWN_MASK 修饰符或旧的 _MASK 修饰符,但是在一个事件中不应混用两种模型。首选扩展的修饰符。 -
keyCode
- 实际键的整数代码,或者为 VK_UNDEFINED(对于键入键事件) -
keyChar
- 此事件所生成的 Unicode 字符,或者为 CHAR_UNDEFINED(对于未映射到有效 Unicode 字符的按下键和释放键事件)
-
抛出:
-
IllegalArgumentException
- 如果 id
为 KEY_TYPED
且 keyChar
为 CHAR_UNDEFINED
;或者 id
为 KEY_TYPED
且 keyCode
不为 VK_UNDEFINED
-
IllegalArgumentException
- 如果 source
为 null
KeyEvent
1 2 3 4 5 6 | <font size= "-1" >@Deprecated
</font> public <b>KeyEvent</b>(Component source,
int id,
long when,
int modifiers,
int keyCode)
|
-
已过时。 从 JDK1.1 开始
getKeyCode
1 | public int <b>getKeyCode</b>()
|
- 返回与此事件中的键关联的整数 keyCode。
- 返回:
- 键盘上实际键的整数代码。(对于
KEY_TYPED
事件,该 keyCode 为 VK_UNDEFINED
。)
setKeyCode
1 | public void <b>setKeyCode</b>(int keyCode)
|
- 设置 keyCode 值,以表示某个物理键。
- 参数:
-
keyCode
- 与键盘上实际键相对应的一个整数。
getKeyChar
1 | public char <b>getKeyChar</b>()
|
- 返回与此事件中的键关联的字符。例如,shift + "a" 的
KEY_TYPED
事件返回值 "A"。
KEY_PRESSED
和 KEY_RELEASED
事件不用于报告字符输入。因此,可以保证此方法返回的值只对 KEY_TYPED
事件有意义。
- 返回:
- 为此按键事件定义的 Unicode 字符。如果对于此按键事件没有有效的 Unicode 字符,则返回
CHAR_UNDEFINED
。
setKeyChar
1 | public void <b>setKeyChar</b>(char keyChar)
|
- 设置 keyCode 值,以表示某个逻辑字符。
- 参数:
-
keyChar
- 与构成此事件的键击组合相对应的 char 值。
setModifiers
1 2 | <font size= "-1" >@Deprecated
</font> public void <b>setModifiers</b>(int modifiers)
|
-
已过时。 从 JDK1.1.4 开始
- 设置修饰符,以指出所按住的修改键(例如 shift、ctrl、alt、meta),该动作被定义为 InputEvent 的一部分。
注:因为很多 AWT 实现不识别修饰符的改变,所以不推荐使用此方法。对于其中更改了 shift 修饰符的 KEY_TYPED
事件更是如此。
- 参数:
-
modifiers
- 修饰符常量的整数组合。
- 另请参见:
InputEvent
getKeyLocation
1 | public int <b>getKeyLocation</b>()
|
- 返回产生此按键事件的键位置。
某些键在键盘上出现多次,如左右 shift 键。另外,某些键则出现在数字键盘上。此方法提供了一种区分这些键的方式。
- 返回:
- 被按下或释放的键的位置。总是为
KEY_TYPED
事件返回 KEY_LOCATION_UNKNOWN
。
- 从以下版本开始:
- 1.4
getKeyText
1 | public static String <b>getKeyText</b>(int keyCode)
|
- 返回描述 keyCode 的 String,如 "HOME"、"F1" 或 "A"。通过更改 awt.properties 文件可以本地化这些字符串。
- 返回:
- 包含物理键文本描述的字符串,物理键通过其 keyCode 标识。
getKeyModifiersText
1 | public static String <b>getKeyModifiersText</b>(int modifiers)
|
- 返回描述修改键的
String
,如 "Shift" 或 "Ctrl+Shift"。通过更改 awt.properties
文件可以本地化这些字符串。
注意,InputEvent.ALT_MASK
和 InputEvent.BUTTON2_MASK
具有相同的值,所以对这两个修饰符返回字符串 "Alt"。同样,InputEvent.META_MASK
和 InputEvent.BUTTON3_MASK
具有相同的值,所以对这两个修饰符返回字符串 "Meta"。
- 返回:
- 一个字符串,它是在事件期间所按住的修改键组合的文本描述
- 另请参见:
InputEvent.getModifiersExText(int)
isActionKey
1 | public boolean <b>isActionKey</b>()
|
- 返回此事件中的键是否为“动作”键。通常动作键不会激发 unicode 字符并且不是修改键。
- 返回:
- 如果该键是“动作”键,则返回
true
;否则返回 false
paramString
1 | public String <b>paramString</b>()
|
- 返回标识此事件的参数字符串。此方法对于事件记录和调试很有用。
- 覆盖:
- 类
ComponentEvent
中的 paramString
- 返回:
- 标识事件及其属性的字符串
|
JavaTM 2 Platform Standard Ed. 6
|
上一个类
下一个类 |
框架
无框架
|
摘要: 嵌套 | 字段 | 构造方法 | 方法 |
详细信息: 字段 | 构造方法 | 方法 |
提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。 版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。