JSplitPane : JSplitPane « Swing « Java Tutorial






  1. Allows you to display components in a single row or column.
  2. JSplitPane can display two-and only two-components.
  3. The components are of variable size and separated by a movable divider.
public JSplitPane()
JSplitPane splitPane = new JSplitPane();
public JSplitPane(int newOrientation)
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

public JSplitPane(int newOrientation, boolean newContinuousLayout)
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);

public JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
JComponent topComponent = new JButton("Top Button");
JComponent bottomComponent = new JButton("Bottom Button");
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent);

public JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topComponent, bottomComponent);

The continuousLayout property setting determines how the split pane reacts when the user drags the divider.

  1. false (the default), only the divider is redrawn when dragged.
  2. true, the JSplitPane resizes and redraws the components on each side of the divider as the user drags the divider.








14.50.JSplitPane
14.50.1.JSplitPane
14.50.2.Moving the JSplitPane DividerMoving the JSplitPane Divider
14.50.3.Setting Orientation: JSplitPane.VERTICAL_SPLIT or JSplitPane.HORIZONTAL_SPLITSetting Orientation: JSplitPane.VERTICAL_SPLIT or JSplitPane.HORIZONTAL_SPLIT
14.50.4.Create a left-right split pane
14.50.5.Create a top-bottom split pane
14.50.6.Resizing Components and Working with a One-Touch Expandable DividerResizing Components and Working with a One-Touch Expandable Divider
14.50.7.Nested JSplitPaneNested JSplitPane
14.50.8.Listening for JSplitPane Property ChangesListening for JSplitPane Property Changes
14.50.9.set Divider Location for JSplitPane
14.50.10.Continuously move the divider and resize its child components while the user is dragging the divider
14.50.11.The split pane supports a one-touch-expandable capability that allows the user to conveniently move the divider to either end with a single click
14.50.12.Distributing Space When a JSplitPane Container Is Resized
14.50.13.Getting the Setting the Children in a JSplitPane Container
14.50.14.Customizing a JSplitPane Look and Feel