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

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

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

revision 1.16 by rabbit78, Fri May 27 21:12:46 2005 UTC revision 1.17 by rabbit78, Fri Jun 17 11:53:50 2005 UTC
# Line 430  public class JInternalFrame extends JCom Line 430  public class JInternalFrame extends JCom
430    /** Whether the JInternalFrame can be maximized. */    /** Whether the JInternalFrame can be maximized. */
431    protected boolean maximizable;    protected boolean maximizable;
432    
433    /** Whether the JInternalFrame has rootPaneChecking enabled. */    /**
434    protected boolean rootPaneCheckingEnabled = true;     * Whether the JInternalFrame has rootPaneChecking enabled.
435       *
436       * @specnote Should be false to comply with J2SE 5.0
437       */
438      protected boolean rootPaneCheckingEnabled = false;
439    
440      /**
441       * Tells us if we're in the initialization stage.
442       * If so, adds go to top-level Container, otherwise they go
443       * to the content pane for this container.
444       */
445      private boolean initStageDone = false;
446    
447    /** Whether the JInternalFrame is resizable. */    /** Whether the JInternalFrame is resizable. */
448    protected boolean resizable;    protected boolean resizable;
# Line 554  public class JInternalFrame extends JCom Line 565  public class JInternalFrame extends JCom
565      this.maximizable = maximizable;      this.maximizable = maximizable;
566      this.iconable = iconifiable;      this.iconable = iconifiable;
567      storedBounds = new Rectangle();      storedBounds = new Rectangle();
   
     setRootPaneCheckingEnabled(false);  
568      setRootPane(createRootPane());      setRootPane(createRootPane());
   
569      updateUI();      updateUI();
570      setRootPaneCheckingEnabled(true);      initStageDone = true; // Done the init stage, now adds go to content pane.
571    }    }
572    
573    /**    /**
# Line 576  public class JInternalFrame extends JCom Line 584  public class JInternalFrame extends JCom
584     */     */
585    protected void addImpl(Component comp, Object constraints, int index)    protected void addImpl(Component comp, Object constraints, int index)
586    {    {
587      if (isRootPaneCheckingEnabled())      // If we're adding the rootPane (initialization stages) use super.add.
588        throw new Error("Do not use add() on JInternalPane directly. Use getContentPane().add() instead");      // otherwise pass the add onto the content pane.
589        if (comp==rootPane)
590      super.addImpl(comp, constraints, index);        super.addImpl(comp,constraints, index);
591        else
592          {
593            if (isRootPaneCheckingEnabled())
594              throw new Error("Do not use add() on JInternalFrame directly. Use "
595                               + "getContentPane().add() instead");
596            getContentPane().add(comp, constraints, index);
597          }
598    }    }
599    
600    /**    /**
# Line 1181  public class JInternalFrame extends JCom Line 1196  public class JInternalFrame extends JCom
1196     */     */
1197    public void remove(Component comp)    public void remove(Component comp)
1198    {    {
1199      super.remove(comp);      // If we're removing the root pane, use super.remove.  Otherwise
1200        // pass it on to the content pane instead.
1201        if (comp==rootPane)
1202          super.remove(comp);
1203        else
1204          getContentPane().remove(comp);
1205    }    }
1206    
1207    /**    /**
# Line 1466  public class JInternalFrame extends JCom Line 1486  public class JInternalFrame extends JCom
1486     */     */
1487    public void setLayout(LayoutManager manager)    public void setLayout(LayoutManager manager)
1488    {    {
1489      if (isRootPaneCheckingEnabled())      // Check if we're in initialization stage.  If so, call super.setLayout
1490        throw new Error("Cannot set layout. Use getContentPane().setLayout() instead.");      // otherwise, valid calls go to the content pane.
1491      super.setLayout(manager);      if (initStageDone)
1492          {
1493            if (isRootPaneCheckingEnabled())
1494              throw new Error("Cannot set layout. Use getContentPane().setLayout()"
1495                               + " instead.");
1496            getContentPane().setLayout(manager);
1497          }
1498        else
1499          super.setLayout(manager);
1500    }    }
1501    
1502    /**    /**

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

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