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

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

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

revision 1.13.2.6 by gnu_andrew, Wed Nov 2 00:43:45 2005 UTC revision 1.13.2.7 by gnu_andrew, Sun Nov 27 21:00:37 2005 UTC
# Line 102  public class JFrame extends Frame Line 102  public class JFrame extends Frame
102     */     */
103    protected boolean rootPaneCheckingEnabled = false;    protected boolean rootPaneCheckingEnabled = false;
104    
   /**  
    * 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;  
   
105    public JFrame()    public JFrame()
106    {    {
107      super("JFrame");      super("JFrame");
# Line 158  public class JFrame extends Frame Line 151  public class JFrame extends Frame
151      enableEvents(AWTEvent.WINDOW_EVENT_MASK);      enableEvents(AWTEvent.WINDOW_EVENT_MASK);
152      getRootPane(); // will do set/create      getRootPane(); // will do set/create
153      // We're now done the init stage.      // We're now done the init stage.
154      initStageDone = true;      setRootPaneCheckingEnabled(true);
155    }    }
156    
157    public Dimension getPreferredSize()    public Dimension getPreferredSize()
# Line 180  public class JFrame extends Frame Line 173  public class JFrame extends Frame
173    {    {
174      // Check if we're in initialization stage.  If so, call super.setLayout      // Check if we're in initialization stage.  If so, call super.setLayout
175      // otherwise, valid calls go to the content pane.      // otherwise, valid calls go to the content pane.
176      if (initStageDone)      if (isRootPaneCheckingEnabled())
177        {        getContentPane().setLayout(manager);
         if (isRootPaneCheckingEnabled())  
           throw new Error("Cannot set layout. Use getContentPane().setLayout()"  
                            + " instead.");  
         getContentPane().setLayout(manager);  
       }  
178      else      else
179        super.setLayout(manager);        super.setLayout(manager);
180    }    }
# Line 246  public class JFrame extends Frame Line 234  public class JFrame extends Frame
234    {    {
235      // If we're adding in the initialization stage use super.add.      // If we're adding in the initialization stage use super.add.
236      // Otherwise pass the add onto the content pane.      // Otherwise pass the add onto the content pane.
237      if (!initStageDone)      if (isRootPaneCheckingEnabled())
238        super.addImpl(comp, constraints, index);        getContentPane().add(comp,constraints,index);
239      else      else
240        {        super.addImpl(comp, constraints, index);
         if (isRootPaneCheckingEnabled())  
           throw new Error("rootPaneChecking is enabled - adding components "  
                            + "disallowed.");  
         getContentPane().add(comp,constraints,index);  
       }  
241    }    }
242    
243    public void remove(Component comp)    public void remove(Component comp)

Legend:
Removed from v.1.13.2.6  
changed lines
  Added in v.1.13.2.7

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