Package swingtree

Class TabDelegate


public final class TabDelegate extends ComponentMouseEventDelegate<JTabbedPane>
A JTabbedPane delegate providing useful context information to various Action listeners used by UIForTabbedPane.onTabMouseClick(Action), UIForTabbedPane.onTabMousePress(Action) and UIForTabbedPane.onTabMouseRelease(Action), for example.
Not only does this delegate provide access to the JTabbedPane component itself, but also to the MouseEvent that triggered the event and the index of the clicked tab.
  • Constructor Details

  • Method Details

    • selectedTabIndex

      public final int selectedTabIndex()
      Exposes the index of the currently selected tab.
      Returns:
      The index of the clicked tab.
    • tabIndex

      public final int tabIndex()
      Exposes the index of the currently delegated tab, in the form of an integer starting at 0. It represents the position of the tab in the array of all existing tabs within the underlying JTabbedPane.
      Returns:
      The index of the clicked tab.
    • tabIsSelected

      public final boolean tabIsSelected()
      Reports whether the clicked tab is the currently selected tab, which is determined by comparing the index of the clicked tab with the index of the currently selected tab.
      Returns:
      True if the clicked tab is the currently selected tab.
    • tabComponent

      public final JComponent tabComponent()
      Use this to access the tab component of the delegated tab.
      Returns:
      The component of the clicked tab.