Java Reference
In-Depth Information
public JSplitPane(int newOrientation, boolean newContinuousLayout,
Component newLeftComponent, Component newRightComponent)
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
topComponent, bottomComponent);
Unless otherwise specified, the orientation is horizontal. Orientation can be specified by
either of the
JSplitPane
constants
VERTICAL_SPLIT
or
HORIZONTAL_SPLIT
. The
continuousLayout
property setting determines how the split pane reacts when the user drags the divider. When
the setting is
false
(the default), only the divider is redrawn when dragged. When the setting is
true
, the
JSplitPane
resizes and redraws the components on each side of the divider as the
user drags the divider.
■
Note
If the orientation is
JSplitPane.VERTICAL_SPLIT
, you can think of the top component as the left
component and the bottom component as the right component.
If you're using the no-argument constructor, the initial set of components within the split
pane is made up of buttons (two
JButton
components). Two other constructors explicitly set
the initial two components. Surprisingly, the remaining two constructors provide no components
within the container by default. To add or change the components within the
JSplitPane
, see
the “Changing JSplitPane Components” section that's coming up shortly.
JSplitPane Properties
Table 11-2 shows the 17 properties of
JSplitPane
.
Table 11-2.
JSplitPane Properties
Property Name
Data Type
Access
accessibleContext
AccessibleContext
Read-only
bottomComponent
Component
Read-write
continuousLayout
boolean
Read-write bound
dividerLocation
double
Write-only
dividerLocation
int
Read-write bound
dividerSize
int
Read-write bound
lastDividerLocation
int
Read-write bound
leftComponent
Component
Read-write
maximumDividerLocation
int
Read-only
minimumDividerLocation
int
Read-only