--- /home/cpdev/src/classpath/javax/swing/JInternalFrame.java	2005-07-12 05:32:51.000000000 +0000
+++ javax/swing/JInternalFrame.java	2005-06-30 05:35:09.000000000 +0000
@@ -76,8 +76,6 @@
   protected class AccessibleJInternalFrame extends AccessibleJComponent
     implements AccessibleValue
   {
-    private static final long serialVersionUID = 5931936924175476797L;
-
     /**
      * Creates a new AccessibleJInternalFrame object.
      */
@@ -170,8 +168,6 @@
     protected class AccessibleJDesktopIcon extends AccessibleJComponent
       implements AccessibleValue
     {
-      private static final long serialVersionUID = 5035560458941637802L;
-
       /**
        * Creates a new AccessibleJDesktopIcon object.
        */
@@ -243,8 +239,6 @@
       }
     }
 
-    private static final long serialVersionUID = 4672973344731387687L;
-
     /** The JInternalFrame this DesktopIcon represents. */
     JInternalFrame frame;
 
@@ -430,19 +424,8 @@
   /** Whether the JInternalFrame can be maximized. */
   protected boolean maximizable;
 
-  /**
-   * Whether the JInternalFrame has rootPaneChecking enabled.
-   *
-   * @specnote Should be false to comply with J2SE 5.0
-   */
-  protected boolean rootPaneCheckingEnabled = false;
-
-  /**
-   * 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;
+  /** Whether the JInternalFrame has rootPaneChecking enabled. */
+  protected boolean rootPaneCheckingEnabled = true;
 
   /** Whether the JInternalFrame is resizable. */
   protected boolean resizable;
@@ -565,9 +548,12 @@
     this.maximizable = maximizable;
     this.iconable = iconifiable;
     storedBounds = new Rectangle();
+
+    setRootPaneCheckingEnabled(false);
     setRootPane(createRootPane());
+
     updateUI();
-    initStageDone = true; // Done the init stage, now adds go to content pane.
+    setRootPaneCheckingEnabled(true);
   }
 
   /**
@@ -584,18 +570,10 @@
    */
   protected void addImpl(Component comp, Object constraints, int index)
   {
-    // If we're in the initialization stage use super.add. Here we add the
-    // rootPane as well as the title bar and other stuff.
-    // Otherwise pass the add onto the content pane.
-    if (!initStageDone)
-      super.addImpl(comp,constraints, index);
-    else
-      {
-        if (isRootPaneCheckingEnabled())
-          throw new Error("Do not use add() on JInternalFrame directly. Use "
-                           + "getContentPane().add() instead");
-        getContentPane().add(comp, constraints, index);
-      }
+    if (isRootPaneCheckingEnabled())
+      throw new Error("Do not use add() on JInternalPane directly. Use getContentPane().add() instead");
+
+    super.addImpl(comp, constraints, index);
   }
 
   /**
@@ -884,10 +862,7 @@
   {
     JDesktopPane pane = getDesktopPane();
     if (pane != null)
-      // The cast here forces the call to the instance method getLayer()
-      // instead of the static method (this would lead to infinite
-      // recursion).
-      return pane.getLayer((Component) this);
+      return pane.getLayer(this);
     return -1;
   }
 
@@ -1166,7 +1141,7 @@
       {
 	// Do nothing if they don't want to be restored first.
       }
-    setSize(getPreferredSize());
+    doLayout();
   }
 
   /**
@@ -1197,12 +1172,7 @@
    */
   public void remove(Component comp)
   {
-    // If we're removing the root pane, use super.remove.  Otherwise
-    // pass it on to the content pane instead.
-    if (comp==rootPane)
-      super.remove(comp);
-    else
-      getContentPane().remove(comp);
+    super.remove(comp);
   }
 
   /**
@@ -1306,10 +1276,10 @@
    */
   public void setDefaultCloseOperation(int operation)
   {
-    /* Reference implementation allows invalid operations to be specified.
-       In that case, behaviour defaults to DO_NOTHING_ON_CLOSE.
-       processWindowEvent handles the behaviour. getDefaultCloseOperation
-       must return the invalid operator code. */
+    if (operation != DO_NOTHING_ON_CLOSE
+	&& operation != HIDE_ON_CLOSE
+        && operation != DISPOSE_ON_CLOSE)
+      throw new Error("Close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
     defaultCloseOperation = operation;
   }
 
@@ -1487,17 +1457,9 @@
    */
   public void setLayout(LayoutManager manager)
   {
-    // Check if we're in initialization stage.  If so, call super.setLayout
-    // otherwise, valid calls go to the content pane.
-    if (initStageDone)
-      {
-        if (isRootPaneCheckingEnabled())
-          throw new Error("Cannot set layout. Use getContentPane().setLayout()"
-                           + " instead.");
-        getContentPane().setLayout(manager);
-      }
-    else
-      super.setLayout(manager);
+    if (isRootPaneCheckingEnabled())
+      throw new Error("Cannot set layout. Use getContentPane().setLayout() instead.");
+    super.setLayout(manager);
   }
 
   /**
