This patch makes the JInternalFrame set itself invisible in the
constructor rather then in the UI. This makes the SwingSet InternalFrame
demo work!

2006-03-03  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/JInternalFrame.java
        (JInternalFrame): Set frame invisible.
        (show): Reformatted.
        * javax/swing/plaf/basic/BasicInternalFrameUI.java
        (installDefaults): Do not set invisible here.

/Roman
Index: javax/swing/JInternalFrame.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JInternalFrame.java,v
retrieving revision 1.25
diff -u -r1.25 JInternalFrame.java
--- javax/swing/JInternalFrame.java	15 Feb 2006 17:32:30 -0000	1.25
+++ javax/swing/JInternalFrame.java	3 Mar 2006 20:12:05 -0000
@@ -559,6 +559,8 @@
     this.iconable = iconifiable;
     storedBounds = new Rectangle();
     setRootPane(createRootPane());
+    // JInternalFrames are invisible by default.
+    setVisible(false);
     updateUI();
     setRootPaneCheckingEnabled(true); // Done the init stage, now adds go to content pane.
   }
@@ -1629,27 +1631,27 @@
   {
     if (! isVisible())
       {
-	super.show();
+        super.show();
 
-	JDesktopPane pane = getDesktopPane();
-	if (pane != null)
-	  pane.setSelectedFrame(this);
-	else
-	  {
-	    try
-	      {
-		setSelected(true);
-	      }
-	    catch (PropertyVetoException e)
-	      {
-		// Do nothing. if they don't want to be selected.
-	      }
-	  }
-	if (isFirstTimeVisible)
-	  {
-	    isFirstTimeVisible = false;
-	    fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
-	  }
+        JDesktopPane pane = getDesktopPane();
+        if (pane != null)
+          pane.setSelectedFrame(this);
+        else
+          {
+            try
+              {
+                setSelected(true);
+              }
+            catch (PropertyVetoException e)
+              {
+                // Do nothing. if they don't want to be selected.
+              }
+          }
+        if (isFirstTimeVisible)
+          {
+            isFirstTimeVisible = false;
+            fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
+          }
       }
   }
 
Index: javax/swing/plaf/basic/BasicInternalFrameUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v
retrieving revision 1.27
diff -u -r1.27 BasicInternalFrameUI.java
--- javax/swing/plaf/basic/BasicInternalFrameUI.java	3 Mar 2006 11:06:11 -0000	1.27
+++ javax/swing/plaf/basic/BasicInternalFrameUI.java	3 Mar 2006 20:12:05 -0000
@@ -522,18 +522,6 @@
     }
 
     /**
-     * This method returns the maximum layout size.
-     * 
-     * @param c
-     *          The Container to find a maximum layout size for.
-     * @return The maximum dimensions for the JInternalFrame.
-     */
-    public Dimension maximumLayoutSize(Container c)
-    {
-      return preferredLayoutSize(c);
-    }
-
-    /**
      * Th8is method returns the preferred layout size.
      * 
      * @param c
@@ -1167,8 +1155,6 @@
       frame.setLayout(internalFrameLayout);
       LookAndFeel.installBorder(frame, "InternalFrame.border");
       frame.setFrameIcon(UIManager.getIcon("InternalFrame.icon"));
-      // InternalFrames are invisible by default.
-      frame.setVisible(false);
   }
 
   /**

Reply via email to