[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: fix for JComponent
From: |
Roman Kennke |
Subject: |
[cp-patches] FYI: fix for JComponent |
Date: |
Wed, 08 Jun 2005 15:28:19 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050317) |
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 <address@hidden>
* 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);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: fix for JComponent,
Roman Kennke <=