Class BaseTabbedPaneWithTabHiding

    • Constructor Detail

      • BaseTabbedPaneWithTabHiding

        public BaseTabbedPaneWithTabHiding()
        Creates an empty TabbedPane with a default tab placement of JTabbedPane.TOP.
      • BaseTabbedPaneWithTabHiding

        public BaseTabbedPaneWithTabHiding​(int tabPlacement)
        Creates an empty TabbedPane with the specified tab placement of either: JTabbedPane.TOP, JTabbedPane.BOTTOM, JTabbedPane.LEFT, or JTabbedPane.RIGHT.
        Parameters:
        tabPlacement - the placement for the tabs relative to the content
      • BaseTabbedPaneWithTabHiding

        public BaseTabbedPaneWithTabHiding​(int tabPlacement,
                                           int tabLayoutPolicy)
        Creates an empty TabbedPane with the specified tab placement and tab layout policy. Tab placement may be either: JTabbedPane.TOP, JTabbedPane.BOTTOM, JTabbedPane.LEFT, or JTabbedPane.RIGHT. Tab layout policy may be either: JTabbedPane.WRAP_TAB_LAYOUT or JTabbedPane.SCROLL_TAB_LAYOUT.
        Parameters:
        tabPlacement - the placement for the tabs relative to the content
        tabLayoutPolicy - the policy for laying out tabs when all tabs will not fit on one run
    • Method Detail

      • initialize

        protected void initialize()
        Performs further initializations.
        Overrides:
        initialize in class BaseTabbedPane
      • getHiddenComponent

        protected Component getHiddenComponent​(String title)
        Determines the hidden component from the tab title.
        Parameters:
        title - the title of the tab to get the associated component for
        Returns:
        the component or null if not found
      • hideTab

        public Component hideTab​(Component component)
        Hides the tab containing the specified component.
        Parameters:
        component - the component which tab to hide
        Returns:
        the component that was hidden
      • hideTab

        public Component hideTab​(String title)
        Hides the tab with the specified tab title.
        Parameters:
        title - the title of the tab to hide
        Returns:
        the component that was hidden
      • hideTab

        public Component hideTab​(int index)
        Hides the tab at the specified position.
        Parameters:
        index - the index of the tab to hide
        Returns:
        the component that was hidden, null in case of an error
      • displayTab

        public void displayTab​(Component component)
        Displays a hidden tab again.
        Parameters:
        component - the component to display again
      • displayTab

        public void displayTab​(String title)
        Displays a hidden tab again.
        Parameters:
        title - the title of the hidden tab to display again
      • removeAll

        public void removeAll()
        Removes all the tabs and their corresponding components from the tabbedpane. Removes the hidden tabs as well.
        Overrides:
        removeAll in class BaseTabbedPane
      • addHiddenTab

        public void addHiddenTab​(String title,
                                 Icon icon,
                                 Component component,
                                 String tip)
        Adds a hidden component and tip represented by a title and/or icon, either of which can be null.
        Parameters:
        title - the title to be displayed in this tab
        icon - the icon to be displayed in this tab
        component - the component to be displayed when this tab is clicked
        tip - the tooltip to be displayed for this tab
      • addHiddenTab

        public void addHiddenTab​(String title,
                                 Icon icon,
                                 Component component)
        Adds a hidden component represented by a title and/or icon, either of which can be null.
        Parameters:
        title - the title to be displayed in this tab
        icon - the icon to be displayed in this tab
        component - the component to be displayed when this tab is clicked
      • addHiddenTab

        public void addHiddenTab​(String title,
                                 Component component)
        Adds a hidden component represented by a title and no icon.
        Parameters:
        title - the title to be displayed in this tab
        component - the component to be displayed when this tab is clicked
      • isHidden

        public boolean isHidden​(Component comp)
        Checks whether the component is currently hidden.
        Parameters:
        comp - the component to check
        Returns:
        true if the component is hidden
      • isHidden

        public boolean isHidden​(String title)
        Checks whether the tab with the specified title is currently hidden.
        Parameters:
        title - the title of the tab to check
        Returns:
        true if the tab is hidden
      • removeHidden

        public boolean removeHidden​(Component comp)
        Removes the hidden component.
        Parameters:
        comp - the hidden component to remove
        Returns:
        true if successfully remove
      • removeHidden

        public boolean removeHidden​(String title)
        Removes the hidden component.
        Parameters:
        title - the title of the tab to remove
        Returns:
        true if successfully remove
      • addTabVisibilityChangeListener

        public void addTabVisibilityChangeListener​(TabVisibilityChangeListener l)
        Adds a listener for tab visibility.
        Parameters:
        l - the listener to add
      • remvoeTabVisibilityChangeListener

        public void remvoeTabVisibilityChangeListener​(TabVisibilityChangeListener l)
        Removes a listener for tab visibility.
        Parameters:
        l - the listener to remove
      • notifyTabVisibiltiyChangeListeners

        protected void notifyTabVisibiltiyChangeListeners​(TabVisibilityChangeEvent e)
        Notifies all tab visibility listeners about the specified event.
        Parameters:
        e - the event to send