keyevent.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 1,734 行 · 第 1/3 页

JAVA
1,734
字号
  public static final int VK_DEAD_CIRCUMFLEX = 130;

  /**
   * The virtual key VK_DEAD_TILDE.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_TILDE = 131;

  /**
   * The virtual key VK_DEAD_MACRON.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_MACRON = 132;

  /**
   * The virtual key VK_DEAD_BREVE.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_BREVE = 133;

  /**
   * The virtual key VK_DEAD_ABOVEDOT.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_ABOVEDOT = 134;

  /**
   * The virtual key VK_DEAD_DIAERESIS.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_DIAERESIS = 135;

  /**
   * The virtual key VK_DEAD_ABOVERING.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_ABOVERING = 136;

  /**
   * The virtual key VK_DEAD_DOUBLEACUTE.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_DOUBLEACUTE = 137;

  /**
   * The virtual key VK_DEAD_CARON.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_CARON = 138;

  /**
   * The virtual key VK_DEAD_CEDILLA.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_CEDILLA = 139;

  /**
   * The virtual key VK_DEAD_OGONEK.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_OGONEK = 140;

  /**
   * The virtual key VK_DEAD_IOTA.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_IOTA = 141;

  /**
   * The virtual key VK_DEAD_VOICED_SOUND.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_VOICED_SOUND = 142;

  /**
   * The virtual key VK_DEAD_SEMIVOICED_SOUND.
   *
   * @since 1.2
   */
  public static final int VK_DEAD_SEMIVOICED_SOUND = 143;

  /**
   * The virtual key VK_AMPERSAND.
   *
   * @since 1.2
   */
  public static final int VK_AMPERSAND = 150;

  /**
   * The virtual key VK_ASTERISK.
   *
   * @since 1.2
   */
  public static final int VK_ASTERISK = 151;

  /**
   * The virtual key VK_QUOTEDBL.
   *
   * @since 1.2
   */
  public static final int VK_QUOTEDBL = 152;

  /**
   * The virtual key VK_LESS.
   *
   * @since 1.2
   */
  public static final int VK_LESS = 153;

  /**
   * The virtual key VK_GREATER.
   *
   * @since 1.2
   */
  public static final int VK_GREATER = 160;

  /**
   * The virtual key VK_BRACELEFT.
   *
   * @since 1.2
   */
  public static final int VK_BRACELEFT = 161;

  /**
   * The virtual key VK_BRACERIGHT.
   *
   * @since 1.2
   */
  public static final int VK_BRACERIGHT = 162;

  /**
   * The virtual key VK_AT.
   *
   * @since 1.2
   */
  public static final int VK_AT = 512;

  /**
   * The virtual key VK_COLON.
   *
   * @since 1.2
   */
  public static final int VK_COLON = 513;

  /**
   * The virtual key VK_CIRCUMFLEX.
   *
   * @since 1.2
   */
  public static final int VK_CIRCUMFLEX = 514;

  /**
   * The virtual key VK_DOLLAR.
   *
   * @since 1.2
   */
  public static final int VK_DOLLAR = 515;

  /**
   * The virtual key VK_EURO_SIGN.
   *
   * @since 1.2
   */
  public static final int VK_EURO_SIGN = 516;

  /**
   * The virtual key VK_EXCLAMATION_MARK.
   *
   * @since 1.2
   */
  public static final int VK_EXCLAMATION_MARK = 517;

  /**
   * The virtual key VK_INVERTED_EXCLAMATION_MARK.
   *
   * @since 1.2
   */
  public static final int VK_INVERTED_EXCLAMATION_MARK = 518;

  /**
   * The virtual key VK_LEFT_PARENTHESIS.
   *
   * @since 1.2
   */
  public static final int VK_LEFT_PARENTHESIS = 519;

  /**
   * The virtual key VK_NUMBER_SIGN.
   *
   * @since 1.2
   */
  public static final int VK_NUMBER_SIGN = 520;

  /**
   * The virtual key VK_PLUS.
   *
   * @since 1.2
   */
  public static final int VK_PLUS = 521;

  /**
   * The virtual key VK_RIGHT_PARENTHESIS.
   *
   * @since 1.2
   */
  public static final int VK_RIGHT_PARENTHESIS = 522;

  /**
   * The virtual key VK_UNDERSCORE.
   *
   * @since 1.2
   */
  public static final int VK_UNDERSCORE = 523;

  /** The virtual key VK_FINAL. */
  public static final int VK_FINAL = 24;

  /** The virtual key VK_CONVERT. */
  public static final int VK_CONVERT = 28;

  /** The virtual key VK_NONCONVERT. */
  public static final int VK_NONCONVERT = 29;

  /** The virtual key VK_ACCEPT. */
  public static final int VK_ACCEPT = 30;

  /** The virtual key VK_MODECHANGE. */
  public static final int VK_MODECHANGE = 31;

  /** The virtual key VK_KANA. */
  public static final int VK_KANA = 21;

  /** The virtual key VK_KANJI. */
  public static final int VK_KANJI = 25;

  /**
   * The virtual key VK_ALPHANUMERIC.
   *
   * @since 1.2
   */
  public static final int VK_ALPHANUMERIC = 240;

  /**
   * The virtual key VK_KATAKANA.
   *
   * @since 1.2
   */
  public static final int VK_KATAKANA = 241;

  /**
   * The virtual key VK_HIRAGANA.
   *
   * @since 1.2
   */
  public static final int VK_HIRAGANA = 242;

  /**
   * The virtual key VK_FULL_WIDTH.
   *
   * @since 1.2
   */
  public static final int VK_FULL_WIDTH = 243;

  /**
   * The virtual key VK_HALF_WIDTH.
   *
   * @since 1.2
   */
  public static final int VK_HALF_WIDTH = 244;

  /**
   * The virtual key VK_ROMAN_CHARACTERS.
   *
   * @since 1.2
   */
  public static final int VK_ROMAN_CHARACTERS = 245;

  /**
   * The virtual key VK_ALL_CANDIDATES.
   *
   * @since 1.2
   */
  public static final int VK_ALL_CANDIDATES = 256;

  /**
   * The virtual key VK_PREVIOUS_CANDIDATE.
   *
   * @since 1.2
   */
  public static final int VK_PREVIOUS_CANDIDATE = 257;

  /**
   * The virtual key VK_CODE_INPUT.
   *
   * @since 1.2
   */
  public static final int VK_CODE_INPUT = 258;

  /**
   * The virtual key VK_JAPANESE_KATAKANA.
   *
   * @since 1.2
   */
  public static final int VK_JAPANESE_KATAKANA = 259;

  /**
   * The virtual key VK_JAPANESE_HIRAGANA.
   *
   * @since 1.2
   */
  public static final int VK_JAPANESE_HIRAGANA = 260;

  /**
   * The virtual key VK_JAPANESE_ROMAN.
   *
   * @since 1.2
   */
  public static final int VK_JAPANESE_ROMAN = 261;

  /**
   * The virtual key VK_KANA_LOCK.
   *
   * @since 1.3
   */
  public static final int VK_KANA_LOCK = 262;

  /**
   * The virtual key VK_INPUT_METHOD_ON_OFF.
   *
   * @since 1.3
   */
  public static final int VK_INPUT_METHOD_ON_OFF = 263;

  /**
   * The virtual key VK_CUT.
   *
   * @since 1.2
   */
  public static final int VK_CUT = 65489;

  /**
   * The virtual key VK_COPY.
   *
   * @since 1.2
   */
  public static final int VK_COPY = 65485;

  /**
   * The virtual key VK_PASTE.
   *
   * @since 1.2
   */
  public static final int VK_PASTE = 65487;

  /**
   * The virtual key VK_UNDO.
   *
   * @since 1.2
   */
  public static final int VK_UNDO = 65483;

  /**
   * The virtual key VK_AGAIN.
   *
   * @since 1.2
   */
  public static final int VK_AGAIN = 65481;

  /**
   * The virtual key VK_FIND.
   *
   * @since 1.2
   */
  public static final int VK_FIND = 65488;

  /**
   * The virtual key VK_PROPS.
   *
   * @since 1.2
   */
  public static final int VK_PROPS = 65482;

  /**
   * The virtual key VK_STOP.
   *
   * @since 1.2
   */
  public static final int VK_STOP = 65480;

  /**
   * The virtual key VK_COMPOSE.
   *
   * @since 1.2
   */
  public static final int VK_COMPOSE = 65312;

  /**
   * The virtual key VK_ALT_GRAPH.
   *
   * @since 1.2
   */
  public static final int VK_ALT_GRAPH = 65406;

  /**
   * The virtual key VK_UNDEFINED. This is used for key typed events, which
   * do not have a virtual key.
   */
  public static final int VK_UNDEFINED = 0;

  /**
   * The only char with no valid Unicode interpretation. This is used for
   * key pressed and key released events which do not have a valid keyChar.
   */
  public static final char CHAR_UNDEFINED = '\uffff';

  /**
   * Indicates unknown or irrelavent key location. This is also used for
   * key typed events, which do not need a location.
   *
   * @since 1.4
   */
  public static final int KEY_LOCATION_UNKNOWN = 0;

  /**
   * Indicates a standard key location, with no left/right variants and not
   * on the numeric pad.
   *
   * @since 1.4
   */
  public static final int KEY_LOCATION_STANDARD = 1;

  /**
   * Indicates the key is on the left side of the keyboard, such as the left
   * shift.
   *
   * @since 1.4
   */
  public static final int KEY_LOCATION_LEFT = 2;

  /**
   * Indicates the key is on the right side of the keyboard, such as the right
   * shift.
   *
   * @since 1.4
   */
  public static final int KEY_LOCATION_RIGHT = 3;

  /**
   * Indicates the key is on the numeric pad, such as the numpad 0.
   *
   * @since 1.4
   */
  public static final int KEY_LOCATION_NUMPAD = 4;

  /**
   * The code assigned to the physical keyboard location (as adjusted by the
   * keyboard layout). Use the symbolic VK_* names instead of numbers.
   *
   * @see #getKeyCode()
   * @serial the VK_ code for this key
  */
  private int keyCode;

  /**
   * The Unicode character produced by the key type event. This has no meaning
   * for key pressed and key released events.
   *
   * @see #getKeyChar()
   * @serial the Unicode value for this key
   */
  private char keyChar;

  /**
   * The keyboard location of the key. One of {@link #KEY_LOCATION_UNKNOWN},
   * {@link #KEY_LOCATION_STANDARD}, {@link #KEY_LOCATION_LEFT},
   * {@link #KEY_LOCATION_RIGHT}, or {@link #KEY_LOCATION_NUMPAD}.
   *
   * @see #getKeyLocation()
   * @serial the key location
   * @since 1.4
   */
  private final int keyLocation;

  /**
   * Stores the state of the native event dispatching system, to correctly
   * dispatch in Component#dispatchEventImpl when a proxy is active.
   *
   * XXX Does this matter in Classpath?
   *
   * @serial whether the proxy is active
   */
  private boolean isProxyActive;


  /**
   * Initializes a new instance of <code>KeyEvent</code> with the specified
   * information. Note that an invalid id leads to unspecified results.
   *
   * @param source the component that generated this event
   * @param id the event id
   * @param when the timestamp when the even occurred
   * @param modifiers the modifier keys during the event, in old or new style
   * @param keyCode the integer constant for the virtual key type
   * @param keyChar the Unicode value of the key
   * @param keyLocation the location of the key
   * @throws IllegalArgumentException if source is null, if keyLocation is
   *         invalid, or if (id == KEY_TYPED && (keyCode != VK_UNDEFINED
   *         || keyChar == CHAR_UNDEFINED))
   */
  public KeyEvent(Component source, int id, long when, int modifiers,
                  int keyCode, char keyChar, int keyLocation)
  {
    super(source, id, when, modifiers);
    this.keyCode = keyCode;
    this.keyChar = keyChar;
    this.keyLocation = keyLocation;
    if ((id == KEY_TYPED && (keyCode != VK_UNDEFINED
                             || keyChar == CHAR_UNDEFINED))
        || keyLocation < KEY_LOCATION_UNKNOWN
        || keyLocation > KEY_LOCATION_NUMPAD)
      throw new IllegalArgumentException();
  }

  /**
   * Initializes a new instance of <code>KeyEvent</code> with the specified
   * information. Note that an invalid id leads to unspecified results.
   *
   * @param source the component that generated this event
   * @param id the event id
   * @param when the timestamp when the even occurred
   * @param modifiers the modifier keys during the event, in old or new style
   * @param keyCode the integer constant for the virtual key type
   * @param keyChar the Unicode value of the key
   * @throws IllegalArgumentException if source is null, or if
   *         (id == KEY_TYPED && (keyCode != VK_UNDEFINED
   *         || keyChar == CHAR_UNDEFINED))
   */
  public KeyEvent(Component source, int id, long when, int modifiers,
                  int keyCode, char keyChar)
  {
    this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN);
  }

  /**
   * Initializes a new instance of <code>KeyEvent</code> with the specified
   * information. Note that an invalid id leads to unspecified results.
   *
   * @param source the component that generated this event
   * @param id the event id
   * @param when the timestamp when the even occurred
   * @param modifiers the modifier keys during the event, in old or new style
   * @param keyCode the integer constant for the virtual key type
   * @throws IllegalArgumentException if source is null, or if
   *         id == KEY_TYPED but keyCode != VK_UNDEFINED
   */
  public KeyEvent(Component source, int id, long when, int modifiers,
                  int keyCode)
  {
    this(source, id, when, modifiers, keyCode, '\0', KEY_LOCATION_UNKNOWN);
  }

  /**
   * Returns the key code for the event key.  This will be one of the
   * <code>VK_*</code> constants defined in this class. If the event type is
   * KEY_TYPED, the result will be VK_UNDEFINED.
   *

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?