Exemplo n.º 1
0
  public void setVisible(boolean b) {
    KeyboardFocusManager keyboardFocusManager =
        KeyboardFocusManager.getCurrentKeyboardFocusManager();
    if (b) {
      keyboardFocusManager.addKeyEventDispatcher(keyManager);
    } else {
      keyboardFocusManager.removeKeyEventDispatcher(keyManager);
    }
    super.setVisible(b);

    Window owner = getOwner();
    if (owner != null) {
      owner.requestFocus();
      if (lastFocusOwner != null) {
        lastFocusOwner.requestFocusInWindow();
      }
    }
  }
Exemplo n.º 2
0
 /** Deregister us as KeyEventDispatcher and property "managingFocus" listeners. */
 private void removeTraversingOutListeners(KeyboardFocusManager kfm) {
   kfm.removeKeyEventDispatcher(this);
   kfm.removePropertyChangeListener("managingFocus", this);
 }
Exemplo n.º 3
0
 /** Remove the KeyEventDispatcher such that no more keyboard events are being dispatched */
 public static void removeKeyDispatchController() {
   KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
   manager.removeKeyEventDispatcher(keyEventDispatcher);
 }