summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAudrius Meskauskas <audriusa@Bioinformatics.org>2006-05-03 18:04:11 +0000
committerAudrius Meskauskas <audriusa@Bioinformatics.org>2006-05-03 18:04:11 +0000
commit2ad14c42fb34f586955afc82a09506d0b7e6c656 (patch)
tree79d69a2247d101f61e79e595bb7883ac604885ee
parent75189430f5c51609dcf7a54a68dc111a7fd592be (diff)
downloadclasspath-2ad14c42fb34f586955afc82a09506d0b7e6c656.tar.gz
2006-05-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* javax/swing/JSplitPane.java (setDividerLocation(int)): Reset to preferred sizes if the argument is negative.
-rw-r--r--ChangeLog5
-rw-r--r--javax/swing/JSplitPane.java17
2 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f430c2db..0f21ddf8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JSplitPane.java (setDividerLocation(int)):
+ Reset to preferred sizes if the argument is negative.
+
2006-05-03 David Gilbert <david.gilbert@object-refinery.com>
* javax/swing/JList.java: Added/updated API docs.
diff --git a/javax/swing/JSplitPane.java b/javax/swing/JSplitPane.java
index 4e18b7cda..c11512198 100644
--- a/javax/swing/JSplitPane.java
+++ b/javax/swing/JSplitPane.java
@@ -713,16 +713,23 @@ public class JSplitPane extends JComponent implements Accessible
/**
* This method sets the location of the divider.
- *
- * @param location The location of the divider.
+ *
+ * @param location The location of the divider. The negative value forces to
+ * compute the new location from the preferred sizes of the split
+ * pane components.
*/
public void setDividerLocation(int location)
{
if (ui != null && location != getDividerLocation())
{
- int oldLocation = getDividerLocation();
- ((SplitPaneUI) ui).setDividerLocation(this, location);
- firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation, location);
+ int oldLocation = getDividerLocation();
+ if (location < 0)
+ ((SplitPaneUI) ui).resetToPreferredSizes(this);
+ else
+ ((SplitPaneUI) ui).setDividerLocation(this, location);
+
+ firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation,
+ getDividerLocation());
}
}