📄 keyevent.java
字号:
/** @since 1.2 */ public static final int VK_DEAD_DIAERESIS = 0x87; /** @since 1.2 */ public static final int VK_DEAD_ABOVERING = 0x88; /** @since 1.2 */ public static final int VK_DEAD_DOUBLEACUTE = 0x89; /** @since 1.2 */ public static final int VK_DEAD_CARON = 0x8a; /** @since 1.2 */ public static final int VK_DEAD_CEDILLA = 0x8b; /** @since 1.2 */ public static final int VK_DEAD_OGONEK = 0x8c; /** @since 1.2 */ public static final int VK_DEAD_IOTA = 0x8d; /** @since 1.2 */ public static final int VK_DEAD_VOICED_SOUND = 0x8e; /** @since 1.2 */ public static final int VK_DEAD_SEMIVOICED_SOUND = 0x8f; /** @since 1.2 */ public static final int VK_AMPERSAND = 0x96; /** @since 1.2 */ public static final int VK_ASTERISK = 0x97; /** @since 1.2 */ public static final int VK_QUOTEDBL = 0x98; /** @since 1.2 */ public static final int VK_LESS = 0x99; /** @since 1.2 */ public static final int VK_GREATER = 0xa0; /** @since 1.2 */ public static final int VK_BRACELEFT = 0xa1; /** @since 1.2 */ public static final int VK_BRACERIGHT = 0xa2; /** * Constant for the "@" key. * @since 1.2 */ public static final int VK_AT = 0x0200; /** * Constant for the ":" key. * @since 1.2 */ public static final int VK_COLON = 0x0201; /** * Constant for the "^" key. * @since 1.2 */ public static final int VK_CIRCUMFLEX = 0x0202; /** * Constant for the "$" key. * @since 1.2 */ public static final int VK_DOLLAR = 0x0203; /** * Constant for the Euro currency sign key. * @since 1.2 */ public static final int VK_EURO_SIGN = 0x0204; /** * Constant for the "!" key. * @since 1.2 */ public static final int VK_EXCLAMATION_MARK = 0x0205; /** * Constant for the inverted exclamation mark key. * @since 1.2 */ public static final int VK_INVERTED_EXCLAMATION_MARK = 0x0206; /** * Constant for the "(" key. * @since 1.2 */ public static final int VK_LEFT_PARENTHESIS = 0x0207; /** * Constant for the "#" key. * @since 1.2 */ public static final int VK_NUMBER_SIGN = 0x0208; /** * Constant for the "+" key. * @since 1.2 */ public static final int VK_PLUS = 0x0209; /** * Constant for the ")" key. * @since 1.2 */ public static final int VK_RIGHT_PARENTHESIS = 0x020A; /** * Constant for the "_" key. * @since 1.2 */ public static final int VK_UNDERSCORE = 0x020B; /* for input method support on Asian Keyboards */ /* not clear what this means - listed in Win32 API */ public static final int VK_FINAL = 0x0018; /** Constant for the Convert function key. */ /* Japanese PC 106 keyboard, Japanese Solaris keyboard: henkan */ public static final int VK_CONVERT = 0x001C; /** Constant for the Don't Convert function key. */ /* Japanese PC 106 keyboard: muhenkan */ public static final int VK_NONCONVERT = 0x001D; /** Constant for the Accept or Commit function key. */ /* Japanese Solaris keyboard: kakutei */ public static final int VK_ACCEPT = 0x001E; /* not clear what this means - listed in Win32 API */ public static final int VK_MODECHANGE = 0x001F; /* replaced by VK_KANA_LOCK for Win32 and Solaris; might still be used on other platforms */ public static final int VK_KANA = 0x0015; /* replaced by VK_INPUT_METHOD_ON_OFF for Win32 and Solaris; might still be used for other platforms */ public static final int VK_KANJI = 0x0019; /** * Constant for the Alphanumeric function key. * @since 1.2 */ /* Japanese PC 106 keyboard: eisuu */ public static final int VK_ALPHANUMERIC = 0x00F0; /** * Constant for the Katakana function key. * @since 1.2 */ /* Japanese PC 106 keyboard: katakana */ public static final int VK_KATAKANA = 0x00F1; /** * Constant for the Hiragana function key. * @since 1.2 */ /* Japanese PC 106 keyboard: hiragana */ public static final int VK_HIRAGANA = 0x00F2; /** * Constant for the Full-Width Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: zenkaku */ public static final int VK_FULL_WIDTH = 0x00F3; /** * Constant for the Half-Width Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: hankaku */ public static final int VK_HALF_WIDTH = 0x00F4; /** * Constant for the Roman Characters function key. * @since 1.2 */ /* Japanese PC 106 keyboard: roumaji */ public static final int VK_ROMAN_CHARACTERS = 0x00F5; /** * Constant for the All Candidates function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */ public static final int VK_ALL_CANDIDATES = 0x0100; /** * Constant for the Previous Candidate function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */ public static final int VK_PREVIOUS_CANDIDATE = 0x0101; /** * Constant for the Code Input function key. * @since 1.2 */ /* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */ public static final int VK_CODE_INPUT = 0x0102; /** * Constant for the Japanese-Katakana function key. * This key switches to a Japanese input method and selects its Katakana input mode. * @since 1.2 */ /* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */ public static final int VK_JAPANESE_KATAKANA = 0x0103; /** * Constant for the Japanese-Hiragana function key. * This key switches to a Japanese input method and selects its Hiragana input mode. * @since 1.2 */ /* Japanese Macintosh keyboard */ public static final int VK_JAPANESE_HIRAGANA = 0x0104; /** * Constant for the Japanese-Roman function key. * This key switches to a Japanese input method and selects its Roman-Direct input mode. * @since 1.2 */ /* Japanese Macintosh keyboard */ public static final int VK_JAPANESE_ROMAN = 0x0105; /** * Constant for the locking Kana function key. * This key locks the keyboard into a Kana layout. * @since 1.3 */ /* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */ public static final int VK_KANA_LOCK = 0x0106; /** * Constant for the input method on/off key. * @since 1.3 */ /* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */ public static final int VK_INPUT_METHOD_ON_OFF = 0x0107; /* for Sun keyboards */ /** @since 1.2 */ public static final int VK_CUT = 0xFFD1; /** @since 1.2 */ public static final int VK_COPY = 0xFFCD; /** @since 1.2 */ public static final int VK_PASTE = 0xFFCF; /** @since 1.2 */ public static final int VK_UNDO = 0xFFCB; /** @since 1.2 */ public static final int VK_AGAIN = 0xFFC9; /** @since 1.2 */ public static final int VK_FIND = 0xFFD0; /** @since 1.2 */ public static final int VK_PROPS = 0xFFCA; /** @since 1.2 */ public static final int VK_STOP = 0xFFC8; /** * Constant for the Compose function key. * @since 1.2 */ public static final int VK_COMPOSE = 0xFF20; /** * Constant for the AltGraph function key. * @since 1.2 */ public static final int VK_ALT_GRAPH = 0xFF7E; /** * This value is used to indicate that the keyCode is unknown. * KEY_TYPED events do not have a keyCode value; this value * is used instead. */ public static final int VK_UNDEFINED = 0x0; /** * KEY_PRESSED and KEY_RELEASED events which do not map to a * valid Unicode character use this for the keyChar value. */ public static final char CHAR_UNDEFINED = 0xFFFF; /** * A constant indicating that the keyLocation is indeterminate * or not relevant. * KEY_TYPED events do not have a keyLocation; this value * is used instead. * @since 1.4 */ // public static final int KEY_LOCATION_UNKNOWN = 0; /** * A constant indicating that the key pressed or released * is not distinguished as the left or right version of a key, * and did not originate on the numeric keypad (or did not * originate with a virtual key corresponding to the numeric * keypad). * @since 1.4 */ // public static final int KEY_LOCATION_STANDARD = 1; /** * A constant indicating that the key pressed or released is in * the left key location (there is more than one possible location * for this key). Example: the left shift key. * @since 1.4 */ // public static final int KEY_LOCATION_LEFT = 2; /** * A constant indicating that the key pressed or released is in * the right key location (there is more than one possible location * for this key). Example: the right shift key. * @since 1.4 */ // public static final int KEY_LOCATION_RIGHT = 3; /** * A constant indicating that the key event originated on the * numeric keypad or with a virtual key corresponding to the * numeric keypad. * @since 1.4 */ // public static final int KEY_LOCATION_NUMPAD = 4; /** * The unique value assigned to each of the keys on the * keyboard. There is a common set of key codes that * can be fired by most keyboards. * The symbolic name for a key code should be used rather * than the code value itself. * * @serial * @see getKeyCode() * @see setKeyCode() */ int keyCode; /** * <code>keyChar</code> is a valid unicode character * that is fired by a key or a key combination on * a keyboard. * * @serial * @see getKeyChar() * @see setKeyChar() */ char keyChar; /** * The location of the key on the keyboard. * * Some keys occur more than once on a keyboard, e.g. the left and * right shift keys. Additionally, some keys occur on the numeric * keypad. This variable is used to distinguish such keys. * * The only legal values are <code>KEY_LOCATION_UNKNOWN</code>, * <code>KEY_LOCATION_STANDARD</code>, <code>KEY_LOCATION_LEFT</code>, * <code>KEY_LOCATION_RIGHT</code>, and <code>KEY_LOCATION_NUMPAD</code>. * * @serial * @see getKeyLocation() */// int keyLocation; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -2352130953028126954L; /** * Constructs a <code>KeyEvent</code> object. * <p>Note that passing in an invalid <code>id</code> results in * unspecified behavior. * * @param source the <code>Component</code> that originated the event * @param id an integer identifying the type of event * @param when a long integer that specifies the time the event * occurred * @param modifiers the modifier keys down during event (shift, ctrl, * alt, meta) * Either extended _DOWN_MASK or old _MASK modifiers * should be used, but both models should not be mixed * in one event. Use of the extended modifiers is * preferred. * @param keyCode the integer code for an actual key, or VK_UNDEFINED * (for a key-typed event) * @param keyChar the Unicode character generated by this event, or * CHAR_UNDEFINED (for key-pressed and key-released * events which do not map to a valid Unicode character) * @param keyLocation identifies the key location. The only legal * values are <code>KEY_LOCATION_UNKNOWN</code>, * <code>KEY_LOCATION_STANDARD</code>, <code>KEY_LOCATION_LEFT</code>, * <code>KEY_LOCATION_RIGHT</code>, and <code>KEY_LOCATION_NUMPAD</code>. * @exception IllegalArgumentException * if <code>id</code> is <code>KEY_TYPED</code> and * <code>keyChar</code> is <code>CHAR_UNDEFINED</code>; * or if <code>id</code> is <code>KEY_TYPED</code> and * <code>keyCode</code> is not <code>VK_UNDEFINED</code>; * or if <code>id</code> is <code>KEY_TYPED</code> and * <code>keyLocation</code> is not <code>KEY_LOCATION_UNKNOWN</code>; * or if <code>keyLocation</code> is not one of the legal * values enumerated above. * @since 1.4 */ /* private KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation, boolean isProxyActive) { this(source, id, when, modifiers, keyCode, keyChar, keyLocation); this.isProxyActive = isProxyActive; } *//* public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) { super(source, id, when, modifiers); if (id == KEY_TYPED) { if (keyChar == CHAR_UNDEFINED) { throw new IllegalArgumentException("invalid keyChar"); } if (keyCode != VK_UNDEFINED) { throw new IllegalArgumentException("invalid keyCode"); } if (keyLocation != KEY_LOCATION_UNKNOWN) { throw new IllegalArgumentException("invalid keyLocation"); } } this.keyCode = keyCode; this.keyChar = keyChar; if ((keyLocation < KEY_LOCATION_UNKNOWN) || (keyLocation > KEY_LOCATION_NUMPAD)) { throw new IllegalArgumentException("invalid keyLocation"); } //this.keyLocation = keyLocation; if ((getModifiers() != 0) && (getModifiersEx() == 0)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -