Other Swing Changes

New JSplitPane resizeWeight Property

When the size of a JSplitPane changes, the extra space is added to the right/bottom component. This gives the effect of the left/top component being fixed.

The methods get/setResizeWeight(double) have been added. The resizeWeight property indicates how to distribute extra space. The left/top component will get resizeWeight * delta extra space, with the right/bottom component getting (1 - resizeWeight) * delta extra space.


JSplitPane dividerLocation Property Now Bound

The dividerLocation property is bound in JSplitPane.


BasicSplitPaneDivider Border

JSplitPane has a unique border. That is, the border is drawn around both the components, and then drawn around the divider. Previously, one Border was responsible for all this. The problem with this approach is that there is no way to specify the border size drawn around the divider. It also made laying the components out rather tricky.

There is now a Border on the Divider (BasicSplitPaneDivider). As a result, setDividerSize now needs to take into account the border size, which is usually an extra 2 pixels, that is developers used to do setDividerSize(5), but now it will need to be setDividerSize(7) (unless a developer installs a new UI with a different border size).

The javadoc for JSplitPane also mentioned if the size of one the components was changed, an attempt would be made to position the divider correctly. This lead to all sorts of problems, and is no longer supported. Instead, setDividerLocation should be used.


In BasicSplitPaneUI

In BasicSplitPaneDivider

Copyright © 1999 Sun Microsystems, Inc. All Rights Reserved.

Please send comments to: This is not a subscription list.
Java Software