Hi,

Since Roman posted a nice screenshot of ODB:
http://kennke.org/blog/blosxom.cgi/2005/06/14#swing_progress
I thought it would be a good idea to actually make sure that
the Free Swing from CVS actually works for this little demonstration.

Here are two small patches to make sure the ODB console component
doesn't receive early change state events or getPreferredSize() calls
during its initialization.

2005-06-14  Mark Wielaard  <[EMAIL PROTECTED]>

    * javax/swing/JComponent.java (setMinimumSize): Only adjust
    prefferedSize or maximumSize when they are set.
    * javax/swing/JScrollPane.java
    * (JScrollPane(Component,int,int)):
    Set viewport and view manually.

Roman, does this look sane?

Cheers,

Mark
Index: javax/swing/JScrollPane.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JScrollPane.java,v
retrieving revision 1.19
diff -u -r1.19 JScrollPane.java
--- javax/swing/JScrollPane.java        27 May 2005 21:12:46 -0000      1.19
+++ javax/swing/JScrollPane.java        14 Jun 2005 16:04:53 -0000
@@ -588,7 +588,9 @@
     setVerticalScrollBar(createVerticalScrollBar());
     setHorizontalScrollBarPolicy(hsbPolicy);
     setHorizontalScrollBar(createHorizontalScrollBar());
-    setViewportView(view);
+    viewport = createViewport();
+    if (view != null)
+      viewport.setView(view);
     setLayout(new ScrollPaneLayout());
     setOpaque(false);
     updateUI();
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.42
diff -u -r1.42 JComponent.java
--- javax/swing/JComponent.java 8 Jun 2005 13:27:00 -0000       1.42
+++ javax/swing/JComponent.java 14 Jun 2005 16:04:54 -0000
@@ -2065,14 +2065,20 @@
     repaint();
 
     // adjust preferred and maximum size accordingly
-    Dimension prefSize = getPreferredSize();
-    prefSize.width = Math.max(prefSize.width, minimumSize.width);
-    prefSize.height = Math.max(prefSize.height, minimumSize.height);
-    setPreferredSize(prefSize);
-    Dimension maxSize = getMaximumSize();
-    maxSize.width = Math.max(maxSize.width, minimumSize.width);
-    maxSize.height = Math.max(maxSize.height, minimumSize.height);
-    setMaximumSize(maxSize);
+    if (preferredSize != null)
+      {
+       Dimension prefSize = getPreferredSize();
+       prefSize.width = Math.max(prefSize.width, minimumSize.width);
+       prefSize.height = Math.max(prefSize.height, minimumSize.height);
+       setPreferredSize(prefSize);
+      }
+    if (maximumSize != null)
+      {
+       Dimension maxSize = getMaximumSize();
+       maxSize.width = Math.max(maxSize.width, minimumSize.width);
+       maxSize.height = Math.max(maxSize.height, minimumSize.height);
+       setMaximumSize(maxSize);
+      }
   }
 
   /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to