From 2ad14c42fb34f586955afc82a09506d0b7e6c656 Mon Sep 17 00:00:00 2001 From: Audrius Meskauskas Date: Wed, 3 May 2006 18:04:11 +0000 Subject: 2006-05-03 Audrius Meskauskas * javax/swing/JSplitPane.java (setDividerLocation(int)): Reset to preferred sizes if the argument is negative. --- ChangeLog | 5 +++++ javax/swing/JSplitPane.java | 17 ++++++++++++----- 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 + + * javax/swing/JSplitPane.java (setDividerLocation(int)): + Reset to preferred sizes if the argument is negative. + 2006-05-03 David Gilbert * 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()); } } -- cgit v1.2.1