/[classpath]/classpath/java/awt/Window.java
ViewVC logotype

Diff of /classpath/java/awt/Window.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by bryce, Tue Jun 15 22:40:39 2004 UTC revision 1.35 by mark, Thu Jul 22 19:45:38 2004 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package java.awt;  package java.awt;
40    
41  import java.awt.event.ComponentEvent;  import java.awt.event.ComponentEvent;
42    import java.awt.event.FocusEvent;
43    import java.awt.event.WindowAdapter;
44  import java.awt.event.WindowEvent;  import java.awt.event.WindowEvent;
45  import java.awt.event.WindowFocusListener;  import java.awt.event.WindowFocusListener;
46  import java.awt.event.WindowListener;  import java.awt.event.WindowListener;
# Line 85  public class Window extends Container im Line 87  public class Window extends Container im
87    
88    private transient boolean shown;    private transient boolean shown;
89    
90      private transient Component windowFocusOwner;
91    
92    /**    /**
93     * This (package access) constructor is used by subclasses that want     * This (package access) constructor is used by subclasses that want
94     * to build windows that do not have parents.  Eg. toplevel     * to build windows that do not have parents.  Eg. toplevel
# Line 98  public class Window extends Container im Line 102  public class Window extends Container im
102      // cycle roots.      // cycle roots.
103      focusCycleRoot = true;      focusCycleRoot = true;
104      setLayout(new BorderLayout());      setLayout(new BorderLayout());
105    
106        addWindowFocusListener (new WindowAdapter ()
107          {
108            public void windowGainedFocus (WindowEvent event)
109            {
110              if (windowFocusOwner != null)
111                {
112                  // FIXME: move this section and the other similar
113                  // sections in Component into a separate method.
114                  EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
115                  synchronized (eq)
116                    {
117                      KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
118                      Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();
119                      if (currentFocusOwner != null)
120                        {
121                          eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST,
122                                                        false, windowFocusOwner));
123                          eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED,
124                                                        false, currentFocusOwner));
125                        }
126                      else
127                        eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false));
128                    }
129                }
130            }
131          });
132    }    }
133    
134    Window(GraphicsConfiguration gc)    Window(GraphicsConfiguration gc)
# Line 658  public class Window extends Container im Line 689  public class Window extends Container im
689      // The currently-focused Component belongs to the active Window.      // The currently-focused Component belongs to the active Window.
690      if (activeWindow == this)      if (activeWindow == this)
691        return manager.getFocusOwner ();        return manager.getFocusOwner ();
692        else
693          return windowFocusOwner;
694      }
695    
696      return null;    /**
697       * Set the focus owner for this window.  This method is used to
698       * remember which component was focused when this window lost
699       * top-level focus, so that when it regains top-level focus the same
700       * child component can be refocused.
701       *
702       * @param windowFocusOwner the component in this window that owns
703       * the focus.
704       */
705      void setFocusOwner (Component windowFocusOwner)
706      {
707        this.windowFocusOwner = windowFocusOwner;
708    }    }
709    
710    /**    /**
# Line 671  public class Window extends Container im Line 716  public class Window extends Container im
716     */     */
717    public boolean postEvent(Event e)    public boolean postEvent(Event e)
718    {    {
719      // FIXME      return handleEvent (e);
     return false;  
720    }    }
721    
722    /**    /**

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26