Java Reference
In-Depth Information
Figure 11-7.
Setting and using the oneTouchExpandable property
■
Note
There's no easy way to alter the one-touch expandable icon or change how the divider is rendered.
Both are defined by the
BasicSplitPaneDivider
subclass and created in the
createDefaultDivider()
method of the
BasicSplitPaneUI
subclass for the specific look and feel. One thing you can easily change
is the border around the divider, which is a custom border.
The
lastDividerLocation
property allows you or the system to inquire about the previous
divider location. The
JSplitPane
uses this property when the user selects the
maximizer
icon to
undo the minimization of one of the components in the
JSplitPane
.
■
Caution
Beware of components that base their minimum size on the container size or their initial size!
Placing them in a
JSplitPane
may require you to manually set the minimum and/or preferred size of the
components. The components that most frequently cause problems when used within a
JSplitPane
are
JTextArea
and
JScrollPane
.
Resizing the JSplitPane
If additional space is available within the
JSplitPane
that is not required by the preferred size
of the components it contains, this space is allocated based on the
resizeWeight
property
setting. The initial setting of this property is 0.0, meaning the right or bottom component gets
any additional space. Changing the setting to 1.0 would give all the space to the left or top
component. A value of 0.5 would split the space evenly between the two components. Figure 11-8
shows the effect of these changes.