Top Description Inners Fields Constructors Methods
javafx.scene.control

public Class SplitPane

extends Control
Class Inheritance
Annotations
@DefaultProperty:items
Imports
java.util.ArrayList, .Collections, .List, .WeakHashMap, javafx.beans.DefaultProperty, javafx.beans.property.DoubleProperty, .ObjectProperty, .SimpleDoubleProperty, javafx.beans.value.WritableValue, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, javafx.geometry.Orientation, javafx.scene.Node, javafx.css.StyleableObjectProperty, .CssMetaData, .PseudoClass, .Styleable, .StyleableProperty, javafx.css.converter.EnumConverter, javafx.scene.control.skin.SplitPaneSkin

A control that has two or more sides, each separated by a divider, which can be dragged by the user to give more space to one of the sides, resulting in the other side shrinking by an equal amount.

Nodes can be positioned horizontally next to each other, or stacked vertically. This can be controlled by setting the orientationProperty().

The dividers in a SplitPane have the following behavior

Nodes needs to be placed inside a layout container before they are added into the SplitPane. If the node is not inside a layout container the maximum and minimum position of the divider will be the maximum and minimum size of the content.

A divider's position ranges from 0 to 1.0(inclusive). A position of 0 will place the divider at the left/top most edge of the SplitPane plus the minimum size of the node. A position of 1.0 will place the divider at the right/bottom most edge of the SplitPane minus the minimum size of the node. A divider position of 0.5 will place the the divider in the middle of the SplitPane. Setting the divider position greater than the node's maximum size position will result in the divider being set at the node's maximum size position. Setting the divider position less than the node's minimum size position will result in the divider being set at the node's minimum size position. Therefore the value set in setDividerPosition and setDividerPositions may not be the same as the value returned by getDividerPositions.

If there are more than two nodes in the SplitPane and the divider positions are set in such a way that the dividers cannot fit the nodes the dividers will be automatically adjusted by the SplitPane.

For example we have three nodes whose sizes and divider positions are

Node 1: min 25 max 100
Node 2: min 100 max 200
Node 3: min 25 max 50
divider 1: 0.40
divider 2: 0.45

The result will be Node 1 size will be its pref size and divider 1 will be positioned 0.40, Node 2 size will be its min size and divider 2 position will be the min size of Node 2 plus divider 1 position, and the remaining space will be given to Node 3.

SplitPane sets focusTraversable to false.

Example:

 SplitPane sp = new SplitPane();
final StackPane sp1 = new StackPane();
sp1.getChildren().add(new Button("Button One"));
final StackPane sp2 = new StackPane();
sp2.getChildren().add(new Button("Button Two"));
final StackPane sp3 = new StackPane();
sp3.getChildren().add(new Button("Button Three"));
sp.getItems().addAll(sp1, sp2, sp3);
sp.setDividerPositions(0.3f, 0.6f, 0.9f);
Image of the SplitPane control
Since
JavaFX 2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SplitPane.Divider

Represents a single divider in the SplitPane.

private static class

Field Summary

Modifier and TypeField and Description
private static final String
private final WeakHashMap<Integer, Double>
private final ObservableList<SplitPane.Divider>
private static final PseudoClass
private final ObservableList<Node>
private ObjectProperty<Orientation>
private static final String
private final ObservableList<SplitPane.Divider>
private static final PseudoClass

Constructor Summary

AccessConstructor and Description
public
SplitPane()

Creates a new SplitPane with no content.

public
SplitPane(Node...
The items to place inside the SplitPane.
items
)

Creates a new SplitPane with the given items set as the content to split between one or more dividers.

Method Summary

Modifier and TypeMethod and Description
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public static List<CssMetaData<? extends Styleable, ?>>

Returns:

the CssMetaData
getClassCssMetaData
()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public double[]

Returns:

an array of double containing the position of each divider.
getDividerPositions
()

Returns an array of double containing the position of each divider.

public ObservableList<SplitPane.Divider>

Returns:

the list of dividers.
getDividers
()

Returns an unmodifiable list of all the dividers in this SplitPane.

protected Boolean
getInitialFocusTraversable()

Overrides javafx.scene.control.Control.getInitialFocusTraversable.

Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value.

public ObservableList<Node>

Returns:

the list of items in this SplitPane.
getItems
()

Returns an ObservableList which can be use to modify the contents of the SplitPane.

public final Orientation

Returns:

The orientation for the SplitPane.
getOrientation
()

The orientation for the SplitPane.

public static Boolean

Returns:

true if the node is resizable false otherwise.
isResizableWithParent
(Node
A node in the SplitPane.
node
)

Return true if the node is resizable when the parent container is resized false otherwise.

public final ObjectProperty<Orientation>

Returns:

the orientation property for the SplitPane
orientationProperty
()

The orientation for the SplitPane.

public void
setDividerPosition(int
the index of the divider.
dividerIndex
,
double
the divider position, between 0.0 and 1.0 (inclusive).
position
)

Sets the position of the divider at the specified divider index.

public void
setDividerPositions(double...
the divider position, between 0.0 and 1.0 (inclusive).
positions
)

Sets the position of the divider

public final void
setOrientation(Orientation
the orientation value
value
)

This property controls how the SplitPane should be displayed to the user.

public static void
setResizableWithParent(Node
A node in the SplitPane.
node
,
Boolean
true if the node is resizable or false if not resizable.
value
)

Sets a node in the SplitPane to be resizable or not when the SplitPane is resized.

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetControlChildrengetCssMetaDatagetSkingetTooltipisResizablelayoutChildrenloadSkinClassqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinClassNamePropertyskinPropertytooltipProperty

Field Detail

DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
dividerCacheback to summary
private final WeakHashMap<Integer, Double> dividerCache
dividersback to summary
private final ObservableList<SplitPane.Divider> dividers
HORIZONTAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass HORIZONTAL_PSEUDOCLASS_STATE
itemsback to summary
private final ObservableList<Node> items
orientationback to summary
private ObjectProperty<Orientation> orientation
RESIZABLE_WITH_PARENTback to summary
private static final String RESIZABLE_WITH_PARENT
unmodifiableDividersback to summary
private final ObservableList<SplitPane.Divider> unmodifiableDividers
VERTICAL_PSEUDOCLASS_STATEback to summary
private static final PseudoClass VERTICAL_PSEUDOCLASS_STATE

Constructor Detail

SplitPaneback to summary
public SplitPane()

Creates a new SplitPane with no content.

SplitPaneback to summary
public SplitPane(Node... items)

Creates a new SplitPane with the given items set as the content to split between one or more dividers.

Parameters
items:Node[]

The items to place inside the SplitPane.

Since
JavaFX 8u40

Method Detail

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
getClassCssMetaDataback to summary
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

Returns:List<CssMetaData<? extends Styleable, ?>>

the CssMetaData

Since
JavaFX 8.0
getControlCssMetaDataback to summary
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

Annotations
@Override
Since
JavaFX 8.0
getDividerPositionsback to summary
public double[] getDividerPositions()

Returns an array of double containing the position of each divider.

Returns:double[]

an array of double containing the position of each divider.

getDividersback to summary
public ObservableList<SplitPane.Divider> getDividers()

Returns an unmodifiable list of all the dividers in this SplitPane.

Returns:ObservableList<SplitPane.Divider>

the list of dividers.

getInitialFocusTraversableback to summary
protected Boolean getInitialFocusTraversable()

Overrides javafx.scene.control.Control.getInitialFocusTraversable.

Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value. This method is overridden as by default UI controls have focus traversable set to true, but that is not appropriate for this control.

Annotations
@Override
Since
9
getItemsback to summary
public ObservableList<Node> getItems()

Returns an ObservableList which can be use to modify the contents of the SplitPane. The order the nodes are placed into this list will be the same order in the SplitPane.

Returns:ObservableList<Node>

the list of items in this SplitPane.

getOrientationback to summary
public final Orientation getOrientation()

The orientation for the SplitPane.

Returns:Orientation

The orientation for the SplitPane.

isResizableWithParentback to summary
public static Boolean isResizableWithParent(Node node)

Return true if the node is resizable when the parent container is resized false otherwise.

Parameters
node:Node

A node in the SplitPane.

Returns:Boolean

true if the node is resizable false otherwise.

Default Value
true
Since
JavaFX 2.1
orientationPropertyback to summary
public final ObjectProperty<Orientation> orientationProperty()

The orientation for the SplitPane.

Returns:ObjectProperty<Orientation>

the orientation property for the SplitPane

setDividerPositionback to summary
public void setDividerPosition(int dividerIndex, double position)

Sets the position of the divider at the specified divider index.

Parameters
dividerIndex:int

the index of the divider.

position:double

the divider position, between 0.0 and 1.0 (inclusive).

setDividerPositionsback to summary
public void setDividerPositions(double... positions)

Sets the position of the divider

Parameters
positions:double[]

the divider position, between 0.0 and 1.0 (inclusive).

setOrientationback to summary
public final void setOrientation(Orientation value)

This property controls how the SplitPane should be displayed to the user. javafx.geometry.Orientation#HORIZONTAL will result in two (or more) nodes being placed next to each other horizontally, whilst javafx.geometry.Orientation#VERTICAL will result in the nodes being stacked vertically.

Parameters
value:Orientation

the orientation value

setResizableWithParentback to summary
public static void setResizableWithParent(Node node, Boolean value)

Sets a node in the SplitPane to be resizable or not when the SplitPane is resized. By default all node are resizable. Setting value to false will prevent the node from being resized.

Parameters
node:Node

A node in the SplitPane.

value:Boolean

true if the node is resizable or false if not resizable.

Since
JavaFX 2.1
javafx.scene.control back to summary

public Class SplitPane.Divider

extends Object
Class Inheritance

Represents a single divider in the SplitPane.
Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
private DoubleProperty
position

Represents the location where the divider should ideally be positioned, between 0.0 and 1.0 (inclusive).

Constructor Summary

AccessConstructor and Description
public
Divider()

Creates a default Divider instance.

Method Summary

Modifier and TypeMethod and Description
public final double
public final DoubleProperty
public final void
setPosition(double value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

positionback to summary
private DoubleProperty position

Represents the location where the divider should ideally be positioned, between 0.0 and 1.0 (inclusive). 0.0 represents the left- or top-most point, and 1.0 represents the right- or bottom-most point (depending on the horizontal property). The SplitPane will attempt to get the divider to the point requested, but it must take into account the minimum width/height of the nodes contained within it.

As the user drags the SplitPane divider around this property will be updated to always represent its current location.

Default Value
0.5

Constructor Detail

Dividerback to summary
public Divider()

Creates a default Divider instance.

Method Detail

getPositionback to summary
public final double getPosition()
positionPropertyback to summary
public final DoubleProperty positionProperty()
setPositionback to summary
public final void setPosition(double value)
javafx.scene.control back to summary

private Class SplitPane.StyleableProperties

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final CssMetaData<SplitPane, Orientation>
private static final List<CssMetaData<? extends Styleable, ?>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ORIENTATIONback to summary
private static final CssMetaData<SplitPane, Orientation> ORIENTATION
STYLEABLESback to summary
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES

Constructor Detail

StyleablePropertiesback to summary
private StyleableProperties()