GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration();
  Window()  {    visible = false;    // Windows are the only Containers that default to being focus    // cycle roots.    focusCycleRoot = true;    setLayout(new BorderLayout());    addWindowFocusListener (new WindowAdapter ()      {        public void windowGainedFocus (WindowEvent event)        {          if (windowFocusOwner != null)            {              // FIXME: move this section and the other similar              // sections in Component into a separate method.              EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();              synchronized (eq)                {                  KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();                  Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();                  if (currentFocusOwner != null)                    {                      eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST,                                                    false, windowFocusOwner));                      eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED,                                                    false, currentFocusOwner));                    }                  else                    eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false));                }            }        }      });  }