/[classpath]/classpath/javax/swing/JWindow.java
ViewVC logotype

Diff of /classpath/javax/swing/JWindow.java

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

revision 1.11.2.6 by gnu_andrew, Sat Sep 10 15:31:50 2005 UTC revision 1.11.2.7 by gnu_andrew, Sun Nov 27 21:00:38 2005 UTC
# Line 86  public class JWindow extends Window impl Line 86  public class JWindow extends Window impl
86    
87    protected AccessibleContext accessibleContext;    protected AccessibleContext accessibleContext;
88    
   /**  
    * Tells us if we're in the initialization stage.  
    * If so, adds go to top-level Container, otherwise they go  
    * to the content pane for this container.  
    */  
   private boolean initStageDone = false;  
   
89    public JWindow()    public JWindow()
90    {    {
91      super(SwingUtilities.getOwnerFrame());      super(SwingUtilities.getOwnerFrame());
# Line 128  public class JWindow extends Window impl Line 121  public class JWindow extends Window impl
121      super.setLayout(new BorderLayout(1, 1));      super.setLayout(new BorderLayout(1, 1));
122      getRootPane(); // will do set/create      getRootPane(); // will do set/create
123      // Now we're done init stage, adds and layouts go to content pane.      // Now we're done init stage, adds and layouts go to content pane.
124      initStageDone = true;      setRootPaneCheckingEnabled(true);
125    }    }
126    
127    public Dimension getPreferredSize()    public Dimension getPreferredSize()
# Line 140  public class JWindow extends Window impl Line 133  public class JWindow extends Window impl
133    {    {
134      // Check if we're in initialization stage.  If so, call super.setLayout      // Check if we're in initialization stage.  If so, call super.setLayout
135      // otherwise, valid calls go to the content pane.      // otherwise, valid calls go to the content pane.
136      if (initStageDone)      if (isRootPaneCheckingEnabled())
137        {        getContentPane().setLayout(manager);
         if (isRootPaneCheckingEnabled())  
           throw new Error("Cannot set layout. Use getContentPane().setLayout()"  
                            + " instead.");  
         getContentPane().setLayout(manager);  
       }  
138      else      else
139        super.setLayout(manager);        super.setLayout(manager);
140    }    }
# Line 207  public class JWindow extends Window impl Line 195  public class JWindow extends Window impl
195    {    {
196      // If we're adding in the initialization stage use super.add.      // If we're adding in the initialization stage use super.add.
197      // otherwise pass the add onto the content pane.      // otherwise pass the add onto the content pane.
198      if (!initStageDone)      if (isRootPaneCheckingEnabled())
199        super.addImpl(comp, constraints, index);        getContentPane().add(comp, constraints, index);
200      else      else
201        {        super.addImpl(comp, constraints, index);
         if (isRootPaneCheckingEnabled())  
           throw new Error("Do not use add() on JWindow directly. Use "  
                           + "getContentPane().add() instead");  
         getContentPane().add(comp, constraints, index);  
       }  
202    }    }
203    
204    public void remove(Component comp)    public void remove(Component comp)

Legend:
Removed from v.1.11.2.6  
changed lines
  Added in v.1.11.2.7

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