--- /home/cpdev/src/classpath/javax/swing/JDialog.java	2005-07-12 17:32:36.000000000 +0000
+++ javax/swing/JDialog.java	2005-06-30 05:35:09.000000000 +0000
@@ -69,12 +69,8 @@
   /** The single RootPane in the Dialog. */
   protected JRootPane rootPane;
 
-  /**
-   * Whether checking is enabled on the RootPane.
-   *
-   * @specnote Should be false to comply with J2SE 5.0
-   */ 
-  protected boolean rootPaneCheckingEnabled = false;
+  /** Whether checking is enabled on the RootPane */
+  protected boolean rootPaneCheckingEnabled = true;
 
   /** The default action taken when closed. */
   private int close_action = HIDE_ON_CLOSE;
@@ -83,13 +79,7 @@
   private static boolean decorated;
 
   /**
-   * Whether we're in the init stage or not.
-   * If so, adds and layouts are for top-level, otherwise they're for the
-   * content pane
-   */
-  private boolean initStageDone = false;
-
-  /* Creates a new non-modal JDialog with no title 
+   * Creates a new non-modal JDialog with no title 
    * using a shared Frame as the owner.
    */
   public JDialog()
@@ -234,12 +224,12 @@
   protected void dialogInit()
   {
     // FIXME: Do a check on GraphicsEnvironment.isHeadless()
-    setLocale(JComponent.getDefaultLocale());
-    getRootPane(); // Will do set/create.
+    setRootPaneCheckingEnabled(false);
+    setLocale(JComponent.getDefaultLocale());       
+    getRootPane(); // will do set/create  
+    setRootPaneCheckingEnabled(true);    
     invalidate();
-    // Now that initStageDone is true, adds and layouts apply to contentPane,
-    // not top-level.
-    initStageDone = true;
+
   }
 
   /**
@@ -308,17 +298,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 top-level layout.  Use"
-                           + " getConentPane().setLayout instead.");
-          getContentPane().setLayout(manager);
-      }
-    else
-      super.setLayout(manager);
+    if (isRootPaneCheckingEnabled())
+      throw new Error("rootPaneChecking is enabled - cannot set layout.");
+    super.setLayout(manager);
   }
 
   /**
@@ -438,17 +420,9 @@
    */
   protected void addImpl(Component comp, Object constraints, int index)
   {
-    // If we're adding in the initialization stage use super.add.
-    // Otherwise pass the add onto the content pane.
-    if (!initStageDone)
-      super.addImpl(comp, constraints, index);
-    else
-      {
-        if (isRootPaneCheckingEnabled())
-          throw new Error("Do not add directly to JDialog."
-                          + " Use getContentPane().add instead.");
-        getContentPane().add(comp, constraints, index);
-      }
+    if (isRootPaneCheckingEnabled())
+      throw new Error("rootPaneChecking is enabled - adding components disallowed.");
+    super.addImpl(comp, constraints, index);
   }
 
   /**
@@ -458,8 +432,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.
+    // The path changes if the component == root.
     if (comp == rootPane)
       super.remove(rootPane);
     else 
@@ -547,12 +520,12 @@
    */
   public void setDefaultCloseOperation(int operation)
   {
-    /* Reference implementation allows invalid operations
-       to be specified.  If so, getDefaultCloseOperation
-       must return the invalid code, and the behaviour
-       defaults to DO_NOTHING_ON_CLOSE.  processWindowEvent
-       above handles this */
-    close_action = operation;
+    if (operation == DO_NOTHING_ON_CLOSE ||
+    	operation == HIDE_ON_CLOSE ||
+	operation == DISPOSE_ON_CLOSE)
+      close_action = operation;
+    else
+      throw new IllegalArgumentException("Default close operation must be one of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
   }
 
   /**
