Class UITabbedPane

All Implemented Interfaces:
UIKeyHandler, Hintable, Savable

public class UITabbedPane extends UIPanel
A container similar to Swing's JTabbedPane in which multiple components may be contained and viewed one at a time using a set of navigation buttons.
  • Constructor Details

    • UITabbedPane

      public UITabbedPane(UITabbedPane.TabPlacement placement)
      Construct a new Tabbed Pane with the given tab placement.
      Parameters:
      placement - which edge to place the tab buttons on
  • Method Details

    • getTabPlacement

      public UITabbedPane.TabPlacement getTabPlacement()
      Returns:
      which edge we place the tab buttons on
    • getCurrentTab

      public int getCurrentTab()
      Returns:
      the index of the currently viewed tab or -1 if nothing is currently viewed.
    • getTabButton

      public UITab getTabButton(int index)
      Parameters:
      index - the index
      Returns:
      the tab button at the given index.
    • getTabContents

      public UIComponent getTabContents(int index)
      Parameters:
      index - the index
      Returns:
      the component contents for the given tab index.
    • layout

      public void layout()
      Description copied from class: UIComponent
      Override this to perform actual layout.
      Overrides:
      layout in class UIContainer
    • getTabCount

      public int getTabCount()
      Returns:
      the number of components/tabs in this tabbed pane.
    • getViewedComponent

      public UIComponent getViewedComponent()
      Returns:
      the currently viewed tab's component. If no component is viewed, null is returned.
    • add

      public void add(UIComponent component)
      Adds the given component to this tabbed pane with no icon and "unnamed" as the tab label.
      Overrides:
      add in class UIContainer
      Parameters:
      component - the component to add
    • add

      public void add(UIComponent component, String label)
      Adds the given component to this tabbed pane using the given tab label text and no icon.
      Parameters:
      component - the component to add
      label - the text of the tab label
    • add

      public void add(UIComponent component, String label, SubTex icon)
      Adds the given component to this tabbed pane using the given tab label text and icon.
      Parameters:
      component - the component to add
      label - the text of the tab label
      icon - the icon of the tab label
    • removeTab

      public void removeTab(int index)
      Remove the tab at the given tab index.
      Parameters:
      index - the tab index
    • setCurrentTab

      public void setCurrentTab(UITab tab)
      Set the currently viewed component to the one associated with the given tab.
      Parameters:
      tab - the tab
    • setCurrentTab

      public void setCurrentTab(int index)
      Set the currently viewed component to the one at the given tab index.
      Parameters:
      index - the tab index