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.
Information on using JSplitPane
is in
How to Use Split Panes in
The Java Tutorial.
The two Component
s in a split pane can be aligned
left to right using
JSplitPane.HORIZONTAL_SPLIT
, or top to bottom using
JSplitPane.VERTICAL_SPLIT
.
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 {@link JComponent#setMinimumSize}.
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.
For the keyboard keys used by this component in the standard Look and
Feel (L&F) renditions, see the
JSplitPane
key assignments.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see {@link java.beans.XMLEncoder}.
Attribute Summary | ||
---|---|---|
Attribute | Type | Description |
actionmap | ActionMap | Sets the ActionMap to am . |
alignmentx | <float> | Sets the the vertical alignment. |
alignmenty | <float> | Sets the the horizontal alignment. |
autoscrolls | <boolean> | Sets the autoscrolls property.
|
background | <color> | Sets the background color of this component. |
border | Border | Sets the border of this component. |
bottomcomponent | Component | Sets the component below, or to the right of the divider. |
bounds | <rectangle> | Moves and resizes this component to conform to the new
bounding rectangle r . |
componentorientation | ComponentOrientation | Sets the language-sensitive orientation that is to be used to order the elements or text within this component. |
continuouslayout | <boolean> | Sets the value of the continuousLayout property,
which must be true for the child components
to be continuously
redisplayed and laid out during user intervention.
|
cursor | <cursor> | Sets the cursor image to the specified cursor. |
debuggraphicsoptions | <int> | Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. |
defaultlocale | <locale> | Sets the default locale used to initialize each JComponent's locale property upon creation. |
dividerlocation | <double> | Sets the divider location as a percentage of the
JSplitPane 's size.
|
dividerlocation | <int> | Sets the location of the divider. |
dividersize | <int> | Sets the size of the divider. |
doublebuffered | <boolean> | Sets whether the this component should use a buffer to paint. |
droptarget | DropTarget | Associate a DropTarget with this component.
|
enabled | <boolean> | Sets whether or not this component is enabled. |
focusable | <boolean> | Sets the focusable state of this Component to the specified value. |
focuscycleroot | <boolean> | Sets whether this Container is the root of a focus traversal cycle. |
focustraversalkeysenabled | <boolean> | Sets whether focus traversal keys are enabled for this Component. |
focustraversalpolicy | FocusTraversalPolicy | Sets the focus traversal policy that will manage keyboard traversal of this Container's children, if this Container is a focus cycle root. |
font | <font> | Sets the font for this component. |
foreground | <color> | Sets the foreground color of this component. |
ignorerepaint | <boolean> | Sets whether or not paint messages received from the operating system should be ignored. |
inputverifier | InputVerifier | Sets the input verifier for this component. |
lastdividerlocation | <int> | Sets the last location the divider was at to
newLastLocation . |
layout | LayoutManager | Sets the layout manager for this container. |
leftcomponent | Component | Sets the component to the left (or above) the divider. |
locale | <locale> | Sets the locale of this component. |
location | <point> | Moves this component to a new location. |
maximumsize | <dimension> | Sets the maximum size of this component to a constant value. |
minimumsize | <dimension> | Sets the minimum size of this component to a constant value. |
name | <text> | Sets the name of the component to the specified string. |
nextfocusablecomponent | Component | Overrides the default FocusTraversalPolicy for this
JComponent 's focus traversal cycle by unconditionally
setting the specified Component as the next
Component in the cycle, and this JComponent
as the specified Component 's previous
Component in the cycle. |
onetouchexpandable | <boolean> | Sets the value of the oneTouchExpandable property,
which must be true for the
JSplitPane to provide a UI widget
on the divider to quickly expand/collapse the divider.
|
opaque | <boolean> | If true the component paints every pixel within its bounds. |
orientation | <int> | Sets the orientation, or how the splitter is divided. |
preferredsize | <dimension> | Sets the preferred size of this component. |
requestfocusenabled | <boolean> | Provides a hint as to whether or not this JComponent
should get focus. |
resizeweight | <double> | Specifies how to distribute extra space when the size of the split pane changes. |
rightcomponent | Component | Sets the component to the right (or below) the divider. |
size | <dimension> | Resizes this component so that it has width d.width
and height d.height . |
tooltiptext | <text> | Registers the text to display in a tool tip. |
topcomponent | Component | Sets the component above, or to the left of the divider. |
transferhandler | TransferHandler | Sets the transferHandler property,
which is null if the component does
not support data transfer operations.
|
ui | SplitPaneUI | Sets the L&F object that renders this component. |
verifyinputwhenfocustarget | <boolean> | Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. |
visible | <boolean> | Makes the component visible or invisible. |