code: public void ancestorAdded (AncestorEvent e)
      {
          gainedFocus();
  
          if (_window == null) {
              _window = SwingUtilities.getWindowAncestor(_target);
              _window.addWindowFocusListener(this);
          }
      }
docs: documentation inherited from interface AncestorListener