Component focusOwner = getGlobalPermanentFocusOwner ();
Component focusOwner = getFocusOwner(); if (focusOwner == null) focusOwner = getFocusedWindow();
  public boolean dispatchKeyEvent (KeyEvent e)  {    Component focusOwner = getGlobalPermanentFocusOwner ();    if (focusOwner != null)      redispatchEvent(focusOwner, e);    // Loop through all registered KeyEventPostProcessors, giving    // each a chance to process this event.    Iterator i = getKeyEventPostProcessors().iterator();    while (i.hasNext ())  {        KeyEventPostProcessor processor = (KeyEventPostProcessor) i.next ();        if (processor.postProcessKeyEvent ((KeyEvent) e))          return true;  }    // The event hasn't been consumed yet.  Check if it is an    // MenuShortcut.    if (postProcessKeyEvent (e))      return true;    // Always return true.    return true;  }