Esempio 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();
      }
    }
  }
 /** Register us as KeyEventDispatcher and property "managingFocus" listeners. */
 private void addTraversingOutListeners(KeyboardFocusManager kfm) {
   kfm.addKeyEventDispatcher(this);
   kfm.addPropertyChangeListener("managingFocus", this);
 }