class org.aswing.JSplitPane extends Container
Interfaces | |||
Orientable |
|
JSplitPane
is used to divide two (and only two)
Component
s. The two Component
s
are graphically divided based on the look and feel
implementation, and the two Component
s can then be
interactively resized by the user.
The two Component
s in a split pane can be aligned
left to right using
JSplitPane.HORIZONTALSPLIT
, or top to bottom using
JSplitPane.VERTICALSPLIT
.
The preferred way to change the size of the Component
s
is to invoke
setDividerLocation
where location
is either
the new x or y position, depending on the orientation of the
JSplitPane
.
To resize the Component
s to their preferred sizes invoke
resetToPreferredSizes
.
When the user is resizing the Component
s the minimum
size of the Components
is used to determine the
maximum/minimum position the Component
s
can be set to. If the minimum size of the two
components is greater than the size of the split pane the divider
will not allow you to resize it. To alter the minimum size of a
JComponent
, see JComponent#minimumSize
.
When the user resizes the split pane the new space is distributed between
the two components based on the resizeWeight
property.
A value of 0,
the default, indicates the right/bottom component gets all the space,
where as a value of 1 indicates the left/top component gets all the space.
@author paling
Class Fields
static var HORIZONTAL_SPLIT:Int
Horizontal split indicates the Component
s are
split along the x axis. For example the two
Component
s will be split one to the left of the
other.
static var VERTICAL_SPLIT:Int
Vertical split indicates the Component
s are
split along the y axis. For example the two
Component
s will be split one on top of the other.
Instance Fields
var continuousLayout:Bool
true
for the child components
to be continuously redisplayed and laid out during user intervention.
The default value of this property is false
.
Some look and feels might not support continuous layout;
they will ignore this property.
var dividerLocation:Int
The location of the divider.
Setting is passed off to the look and feel implementation, and then listeners are notified.
A value
less than 0 means collapse left/top component. A value equals
AsWingConstants.MAX_VALUE
means collapse right/top component.
var dividerSize:Int
The divider's size, this size is width when the orientation is horizontal it is height when the orientation is vertical.
true
for the
JSplitPane
to provide a UI widget
on the divider to quickly expand/collapse the divider.
The default value of this property is false
.
Some look and feels might not support one-touch expanding;
they will ignore this property.
var orientation:Int
The orientation, or how the splitter is divided. The options are:
- JSplitPane.VERTICALSPLIT (above/below orientation of components)
- JSplitPane.HORIZONTALSPLIT (left/right orientation of components)
var resizeWeight:Float
Specifies how to distribute extra space when the size of the split pane changes.
A value of 0, the default, indicates the right/bottom component gets all the extra space (the left/top component acts fixed), where as a value of 1 specifies the left/top component gets all the extra space (the right/bottom component acts fixed). Specifically, the left/top component gets (weight * diff) extra space and the right/bottom component gets (1 - weight) * diff extra space.
function new(?orientation:Int = 0, ?continuousLayout:Bool = false, ?leftComponent:Component = null, ?rightComponent:Component = null): Void
Creates a new JSplitPane
with the specified
orientation and
redrawing style, and with the specified components.
orientation | (Optional) |
continuousLayout | (Optional) a boolean, true for the components to redraw continuously as the divider changes position, false to wait until the divider position stops changing to redraw. Default is false |
leftComponent | (Optional)the |
rightComponent | (Optional)the |
function removeAt(index:Int): Component
Removes the Component
at the specified index.
Updates the leftComponent
and rightComponent
instance variables as necessary, and then messages super.
index | an integer specifying the component to remove, where 1 specifies the left/top component and 2 specifies the bottom/right component |
function resetToPreferredSizes(): Void
Lays out the JSplitPane
layout based on the preferred size
of the children components. This will likely result in changing
the divider location.