Package jexer

Class TSplitPane

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TSplitPane
    extends TWidget
    TSplitPane contains two widgets with a draggable horizontal or vertical bar between them.
    • Constructor Detail

      • TSplitPane

        public TSplitPane​(TWidget parent,
                          int x,
                          int y,
                          int width,
                          int height,
                          boolean vertical)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of widget
        height - height of widget
        vertical - if true, split vertically
    • Method Detail

      • onResize

        public void onResize​(TResizeEvent event)
        Handle window/screen resize events.
        Overrides:
        onResize in class TWidget
        Parameters:
        event - resize event
      • onMouseDown

        public void onMouseDown​(TMouseEvent mouse)
        Handle mouse button presses.
        Overrides:
        onMouseDown in class TWidget
        Parameters:
        mouse - mouse button event
      • onMouseUp

        public void onMouseUp​(TMouseEvent mouse)
        Handle mouse button releases.
        Overrides:
        onMouseUp in class TWidget
        Parameters:
        mouse - mouse button release event
      • onMouseMotion

        public void onMouseMotion​(TMouseEvent mouse)
        Handle mouse movements.
        Overrides:
        onMouseMotion in class TWidget
        Parameters:
        mouse - mouse motion event
      • draw

        public void draw()
        Draw me on screen.
        Overrides:
        draw in class TWidget
      • toString

        public java.lang.String toString()
        Generate a human-readable string for this widget.
        Overrides:
        toString in class TWidget
        Returns:
        a human-readable string
      • resetTabOrder

        protected void resetTabOrder()
        Reset the tab order of children to match their position in the list. Available so that subclasses can re-order their widgets if needed.
        Overrides:
        resetTabOrder in class TWidget
      • getFocusFollowsMouse

        public boolean getFocusFollowsMouse()
        Get focusFollowsMouse flag.
        Returns:
        true if focus follows mouse: widgets automatically activate if the mouse passes over them
      • setFocusFollowsMouse

        public void setFocusFollowsMouse​(boolean focusFollowsMouse)
        Set focusFollowsMouse flag.
        Parameters:
        focusFollowsMouse - if true, focus follows mouse: widgets are automatically activated if the mouse passes over them
      • setFocusFollowsMouse

        public void setFocusFollowsMouse​(boolean focusFollowsMouse,
                                         boolean recursive)
        Set focusFollowsMouse flag.
        Parameters:
        focusFollowsMouse - if true, focus follows mouse: widgets are automatically activated if the mouse passes over them
        recursive - if true, set the focusFollowsMouse flag of all child TSplitPane's recursively
      • getLeft

        public TWidget getLeft()
        Get the widget on the left side.
        Returns:
        the widget on the left, or null if not set
      • setLeft

        public void setLeft​(TWidget left)
        Set the widget on the left side.
        Parameters:
        left - the widget to set, or null to remove
      • getRight

        public TWidget getRight()
        Get the widget on the right side.
        Returns:
        the widget on the right, or null if not set
      • setRight

        public void setRight​(TWidget right)
        Set the widget on the right side.
        Parameters:
        right - the widget to set, or null to remove
      • getTop

        public TWidget getTop()
        Get the widget on the top side.
        Returns:
        the widget on the top, or null if not set
      • setTop

        public void setTop​(TWidget top)
        Set the widget on the top side.
        Parameters:
        top - the widget to set, or null to remove
      • getBottom

        public TWidget getBottom()
        Get the widget on the bottom side.
        Returns:
        the widget on the bottom, or null if not set
      • setBottom

        public void setBottom​(TWidget bottom)
        Set the widget on the bottom side.
        Parameters:
        bottom - the widget to set, or null to remove
      • removeWidget

        public void removeWidget​(TWidget widget)
        Remove a widget, regardless of what pane it is on.
        Parameters:
        widget - the widget to remove
      • replaceWidget

        public void replaceWidget​(TWidget oldWidget,
                                  TWidget newWidget)
        Replace a widget, regardless of what pane it is on, with another widget.
        Parameters:
        oldWidget - the widget to remove
        newWidget - the widget to replace it with
      • isVertical

        public boolean isVertical()
        Get whether or not this is a vertical split.
        Returns:
        if true, this is a vertical split
      • isHorizontal

        public boolean isHorizontal()
        Get whether or not this is a horizontal split.
        Returns:
        if true, this is a horizontal split
      • getSplit

        public int getSplit()
        Get the split location.
        Returns:
        the row of the divider for a horizontal, or the column for a vertical split
      • setSplit

        public void setSplit​(int split)
        Set the split location.
        Parameters:
        split - the row of the divider for a horizontal, or the column for a vertical split
      • center

        public void center()
        Recenter the split to the middle of this split pane.
      • removeSplit

        public TWidget removeSplit​(TWidget widgetToRemove,
                                   boolean doClose)
        Remove this split, removing the widget specified.
        Parameters:
        widgetToRemove - the widget to remove
        doClose - if true, call the close() method before removing the child
        Returns:
        the pane that remains, or null if nothing is retained