예제 #1
0
  /*
   * Called by the delegate when a key is pressed.
   */
  @Override
  public void notifyKeyEvent(
      int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) {
    LWKeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
    Component focusOwner = kfmPeer.getCurrentFocusOwner();

    if (focusOwner == null) {
      focusOwner = kfmPeer.getCurrentFocusedWindow();
      if (focusOwner == null) {
        focusOwner = this.getTarget();
      }
    }
    postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
  }
예제 #2
0
  /*
   * Called by the delegate when a key is pressed.
   */
  @Override
  public void notifyKeyEvent(
      int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) {
    LWKeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
    Component focusOwner = kfmPeer.getCurrentFocusOwner();

    if (focusOwner == null) {
      focusOwner = kfmPeer.getCurrentFocusedWindow();
      if (focusOwner == null) {
        focusOwner = this.getTarget();
      }
    }

    KeyEvent keyEvent =
        new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation);
    AWTAccessor.getKeyEventAccessor()
        .setExtendedKeyCode(
            keyEvent,
            (keyChar == KeyEvent.CHAR_UNDEFINED)
                ? keyCode
                : ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
    postEvent(keyEvent);
  }