Class ComponentSplitter.SplitPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Enclosing class:
ComponentSplitter

public static class ComponentSplitter.SplitPane extends JSplitPane
Contains methods to automatically show/hide one of its components (the "hideable" component) while the other (the "base" component) remains always visible. Can optionally change the size of its top level ancestorExtension when the component is shown/hidden. The hideable component is initially hidden
See Also:
  • Field Details

  • Constructor Details

    • SplitPane

      public SplitPane(Component hideableComponent, Component baseComponent, int hideablePosition, boolean resizeOnVisibilityChange)
      Initialize the SplitPane with the two component
      Parameters:
      hideableComponent - hideable component
      baseComponent - base component
      hideablePosition - one of HIDE_TOP, HIDE_BOTTOM, HIDE_LEFT or HIDE_RIGHT
      resizeOnVisibilityChange - If true, resize the top-level ancestor when the hideable component is shown/hidden
  • Method Details

    • toggleVisibility

      public void toggleVisibility()
      Toggle the visibility of the hideable component
    • getHideableComponent

      public Component getHideableComponent()
      Returns:
      the Component that can be shown/hidden
    • getBaseComponent

      public Component getBaseComponent()
      Returns:
      the Component that remains always visible
    • getBaseComponentSize

      protected int getBaseComponentSize()
      Returns:
      the size of the base component along the axis of orientation
    • getHideableComponentSize

      protected int getHideableComponentSize()
      Returns:
      the size of the hideable component along the axis of orientation
    • hideComponent

      public void hideComponent()
      Hide the hideable component
    • showTransverseComponent

      protected void showTransverseComponent(ComponentSplitter.SplitPane split)
      Set the divider location and/or the top-level ancestor size to be large enough to display the argument ComponentSplitter.SplitPane's hideable component
      Parameters:
      split - component
    • resizeBaseComponent

      protected void resizeBaseComponent()
      Set the base component size to be large enough to accommodate all descendant SplitPane's showing components
    • getPreferredBaseComponentSize

      protected int getPreferredBaseComponentSize()
      Returns:
      the preferred size of the base component along the orientation axis
    • hideTransverseComponent

      protected void hideTransverseComponent(ComponentSplitter.SplitPane split)
      Set the divider location and/or the top-level ancestor size to the preferred transverse size.
      Parameters:
      split - component
    • getTransverseSize

      protected Dimension getTransverseSize()
      Return the preferred size of the top-level container in the direction transverse to this SplitPane's orientation. Depends on which ancestors have been shown using showTransverseComponent(VASSAL.tools.ComponentSplitter.SplitPane).
    • showComponent

      public void showComponent()
      Show the hideable component
    • getPreferredDividerLocation

      protected int getPreferredDividerLocation()
      Returns:
      the preferred location of the divider when the hideable component is visible
    • getTransverseSplit

      public ComponentSplitter.SplitPane getTransverseSplit()
      Returns:
      the first SplitPane ancestor with a different orientation from this SplitPane
    • getPreferredSize

      public Dimension getPreferredSize()
      If the hideable component is not visible, use the base component's preferred size
      Overrides:
      getPreferredSize in class JComponent