- Allows you to display components in a single row or column.
- JSplitPane can display two-and only two-components.
- 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.
- false (the default), only the divider is redrawn when dragged.
- true, the JSplitPane resizes and redraws the components on each side of the divider as the user drags the divider.