Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp; Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();  if (focusCycleRoot instanceof Window) { FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy (); Component defaultComponent = policy.getDefaultComponent (focusCycleRoot); if (defaultComponent != null) defaultComponent.requestFocusInWindow ();
if (comp != null) comp.transferFocusUpCycle();
  public void upFocusCycle (Component comp)  {    Component focusComp = (comp == null) ? getGlobalFocusOwner () : comp;    Container focusCycleRoot = focusComp.getFocusCycleRootAncestor ();    if (focusCycleRoot instanceof Window)  {        FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();        Component defaultComponent = policy.getDefaultComponent (focusCycleRoot);        if (defaultComponent != null)        defaultComponent.requestFocusInWindow ();  }    else  {        Container parentFocusCycleRoot = focusCycleRoot.getFocusCycleRootAncestor ();        focusCycleRoot.requestFocusInWindow ();        setGlobalCurrentFocusCycleRoot (parentFocusCycleRoot);      }  }