In JComponent it was possible to set a minimumSize to a value greater than preferred and maximumSize. The JDK does adjust the values of prefSize and maxSize so that minimumSize is always less or equal than preferredSize. I fixed this.

2005-06-08  Roman Kennke  <[EMAIL PROTECTED]>

   * javax/swing/JComponent.java:
   (setMinimumSize): Adjust preferredSize and maximumSize when
   minimumSize is greater than preferred or maximumSize.

/Roman

Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.41
diff -u -r1.41 JComponent.java
--- javax/swing/JComponent.java 1 Jun 2005 08:56:16 -0000       1.41
+++ javax/swing/JComponent.java 8 Jun 2005 13:23:57 -0000
@@ -2063,6 +2063,16 @@
     firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
     revalidate();
     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);
   }

   /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to