# Class SplitPane

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.Container
com.codename1.components.SplitPane

All Implemented Interfaces:
  `Animation, Editable, StyleListener, Iterable<Component>`

public class SplitPane extends Container

A Split Pane component.

A split pane can either be horizontal or vertical, and provides a draggable divider between two components. If the `#orientation` is `#HORIZONTAL_SPLIT`, then the child components will be laid out horizontally (side by side with a vertical bar as a divider). If the `#orientation` is `#VERTICAL_SPLIT`, then the components are laid out vertically (one above the other.

The bar divider bar includes arrows to collapse and expand the divider also.

Splitpane UI

The following is an example of a UI that is built around a split pane. This has an outer "horizontal" split pane, and the left side has a vertical split pane.

Collapsed:

Expanded:

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SplitPane.Settings`
  An object to configure settings for a SplitPane.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `HORIZONTAL_SPLIT`
  Constant used for orientation.
  `static final int`
  `VERTICAL_SPLIT`
  Constant used for orientation.

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SplitPane(int orientation, Component topOrLeft, Component bottomOrRight, String minInset, String preferredInset, String maxInset)`
  Creates a new SplitPane.
  `SplitPane(SplitPane.Settings settings, Component topOrLeft, Component bottomOrRight)`
  Creates a new SplitPane.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `changeInsets(String minInset, String preferredInset, String maxInset)`
  Changes the minimum, preferred, and maximum insets of the split pane.
  `void`
  `collapse()`
  Collapses the aplit pane.
  `void`
  `collapse(boolean force)`
  Collapses the split pane.
  `void`
  `expand()`
  Expands the split pane.
  `void`
  `expand(boolean force)`
  Expands the split pane.
  `Component`
  `getBottom()`
  Gets the component that is currently placed in the bottom of the split pane.
  `Component`
  `getBottomOrRightComponent()`
  Gets the component that is currently placed in the bottom or right of the split pane.
  `Component`
  `getLeft()`
  Gets the component that is currently placed in the left of the split pane.
  `String`
  `getMaxInset()`
  Gets the string value of the maximum inset of the divider.
  `String`
  `getMinInset()`
  Gets the string value of the minimum inset of the divider.
  `String`
  `getPreferredInset()`
  Gets the string value of the preferred inset.
  `Component`
  `getRight()`
  Gets the component that is currently placed in the right of the split pane.
  `Component`
  `getTop()`
  Gets the component that is currently placed in the top of the split pane.
  `Component`
  `getTopOrLeftComponent()`
  Gets the component that is currently placed in the top or left of the split pane.
  `void`
  `setBottom(Component cmp)`
  Sets the component to be placed on the bottom of the split pane.
  `void`
  `setInset(String inset)`
  Sets the inset of the divider explicitly.
  `void`
  `setInset(String inset, boolean clamp)`
  Sets the inset of the divider explicitly.
  `void`
  `setLeft(Component cmp)`
  Sets the component that should be placed in the left section of the split pane.
  `void`
  `setMaxInset(String inset)`
  Sets the maximum inset allowed for the divider.
  `void`
  `setMinInset(String inset)`
  Sets the minimum inset allowed for the divider.
  `void`
  `setPreferredInset(String inset)`
  Sets the preferred inset of this split pane.
  `void`
  `setRight(Component cmp)`
  Sets the component to be placed on the right of the split pane.
  `void`
  `setTop(Component cmp)`
  Sets the component that should be placed in the top section of the split pane.
  `void`
  `toggleCollapsePreferred()`
  Toggles the split pane between collapsed state and preferred state.
  `void`
  `toggleExpandPreferred()`
  Toggles the split pane between expanded state and preferred state.

  ### Methods inherited from class Container

  `add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, calcPreferredSize, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, keyPressed, keyReleased, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerPressed, refreshTheme, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices`

  ### Methods inherited from class Component

  `addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, animate, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Iterable

  `forEach`

- ## Field Details

  - ### HORIZONTAL_SPLIT

    public static final int HORIZONTAL_SPLIT
    Constant used for orientation.
    See Also:
      - Constant Field Values

  - ### VERTICAL_SPLIT

    public static final int VERTICAL_SPLIT
    Constant used for orientation.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SplitPane

    public SplitPane(SplitPane.Settings settings, Component topOrLeft, Component bottomOrRight)

    Creates a new SplitPane.

    ###### Parameters

    - `settings`: The settings for the split pane (e.g. insets, styles, etc...).

    - `topOrLeft`: The component to place in the "top" (for vertical), or "left" (for horizontal).

    - `bottomOrRight`: The component to place in the "bottom" (for vertical) or "right" (for horizontal).

  - ### SplitPane

    public SplitPane(int orientation, Component topOrLeft, Component bottomOrRight, String minInset, String preferredInset, String maxInset)

    Creates a new SplitPane.

    ###### Parameters

    - `orientation`: Either `#HORIZONTAL_SPLIT` or `#VERTICAL_SPLIT`

    - `topOrLeft`: The component to place in the "top" (for vertical), or "left" (for horizontal).

    - `bottomOrRight`: The component to place in the "bottom" (for vertical) or "right" (for horizontal).

    - `minInset`: The minimum allowable inset for the divider. The inset should be expressed as a string with both a value and a unit. E.g. "75%", "50mm", "200px".

    - `preferredInset`: The default preferred inset for the divider. The inset should be expressed as a string with both value and unit. E.g. "75%", "50mm", "20px".

    - `maxInset`: The maximum allowable inset for the divider. The inset should be expressed as a string with both a value and a unit. E.g. "75%", "50mm", "20px".

- ## Method Details

  - ### changeInsets

    public void changeInsets(String minInset, String preferredInset, String maxInset)

    Changes the minimum, preferred, and maximum insets of the split pane. This will also update the current divider position to the supplied preferred inset.

    ###### Parameters

    - `minInset`: The minimum inset. Can be expressed in pixels (px), millimetres (mm), or percent (%). E.g. "25%"

    - `preferredInset`: The preferred inset. Can be expressed in pixels (px), millimetres (mm), or percent (%). E.g. "25%"

    - `maxInset`: Can be expressed in pixels (px), millimetres (mm), or percent (%). E.g. "25%"

  - ### getBottomOrRightComponent

    public Component getBottomOrRightComponent()
    Gets the component that is currently placed in the bottom or right of the split pane.

  - ### getBottom

    public Component getBottom()
    Gets the component that is currently placed in the bottom of the split pane.

  - ### setBottom

    public void setBottom(Component cmp)

    Sets the component to be placed on the bottom of the split pane.

    ###### Parameters

    - `cmp`: The component to place on the bottom.

  - ### getRight

    public Component getRight()
    Gets the component that is currently placed in the right of the split pane.

  - ### setRight

    public void setRight(Component cmp)

    Sets the component to be placed on the right of the split pane.

    ###### Parameters

    - `cmp`: The component to place on the right.

  - ### getTopOrLeftComponent

    public Component getTopOrLeftComponent()
    Gets the component that is currently placed in the top or left of the split pane.

  - ### getTop

    public Component getTop()
    Gets the component that is currently placed in the top of the split pane.

  - ### setTop

    public void setTop(Component cmp)

    Sets the component that should be placed in the top section of the split pane.

    ###### Parameters

    - `cmp`: The component to place on top.

  - ### getLeft

    public Component getLeft()
    Gets the component that is currently placed in the left of the split pane.

  - ### setLeft

    public void setLeft(Component cmp)

    Sets the component that should be placed in the left section of the split pane.

    ###### Parameters

    - `cmp`: The component to place on the left.

  - ### toggleCollapsePreferred

    public void toggleCollapsePreferred()
    Toggles the split pane between collapsed state and preferred state. E.g. If the inset is currently not collapsed, it will collapse it. If it is collapsed, it will open to the last position that the user selected.

  - ### toggleExpandPreferred

    public void toggleExpandPreferred()
    Toggles the split pane between expanded state and preferred state. E.g. If the inset is currently expanded, then it will be moved to the last position that the user selected. If it is not expanded, it will expand it all the way.

  - ### expand

    public void expand()
    Expands the split pane. If it is currently completely collapsed, it will transition to the preferred position. If it is in the preferred position, it will expand all the way.

  - ### expand

    public void expand(boolean force)

    Expands the split pane. It will either expand it to the preferred position, or the maximum position depending on the value of the force parameter.

    ###### Parameters

    - `force`: @param force If this is true, then it will only expand "all the way". It will skip the preferred position if it is currently in collapsed state.

  - ### collapse

    public void collapse()
    Collapses the aplit pane. If it is currently expanded, then it will shift to the preferred posiiton. If it is already in the preferred position, it will collapse all the way to the minimum position.

  - ### collapse

    public void collapse(boolean force)

    Collapses the split pane.

    ###### Parameters

    - `force`: True to force it to collapse to minimum position (skipping preferred position if it is in expanded state).

  - ### setInset

    public void setInset(String inset, boolean clamp)

    Sets the inset of the divider explicitly. This The inset is measured from the top for vertical split panes and the left for horizontal split panes. Setting this to "50%" will move the divider to the middle point. Setting it to "0" would set it all the way to the left/top. This will clamp the value at the minimum and maximum offsets if clamp is true.

    ###### Parameters

    - `inset`

    - `clamp`: True to clamp the inset to prevent it from running off the page.

  - ### setInset

    public void setInset(String inset)

    Sets the inset of the divider explicitly. This The inset is measured from the top for vertical split panes and the left for horizontal split panes. Setting this to "50%" will move the divider to the middle point. Setting it to "0" would set it all the way to the left/top. This will clamp the value at the minimum and maximum offsets.

    ###### Parameters

    - `inset`

  - ### getPreferredInset

    public String getPreferredInset()

    Gets the string value of the preferred inset. E.g. "25mm", or "50%". Note: The preferred inset is changed automatically when the user drags it to a new location so the value returned here may be different than the inset supplied in the constructor.

    ###### Returns

    The current preferred inset of the divider.

  - ### setPreferredInset

    public void setPreferredInset(String inset)

    Sets the preferred inset of this split pane. The preferred inset will be automatically changed whenever the user explicitly moves the divider to a new position.

    ###### Parameters

    - `inset`: The inset. E.g. "2mm", "25%", "200px".

  - ### getMinInset

    public String getMinInset()
    Gets the string value of the minimum inset of the divider. E.g. "25mm", or "50%".

  - ### setMinInset

    public void setMinInset(String inset)

    Sets the minimum inset allowed for the divider.

    ###### Parameters

    - `inset`: The inset. E.g. "2mm", "10%", "200px"

  - ### getMaxInset

    public String getMaxInset()
    Gets the string value of the maximum inset of the divider. E.g. "25mm", or "50%"

  - ### setMaxInset

    public void setMaxInset(String inset)

    Sets the maximum inset allowed for the divider.

    ###### Parameters

    - `inset`: The inset. E.g. "2mm", "10%", "200px"