Class SubstanceTabbedPaneUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TabbedPaneUI
javax.swing.plaf.basic.BasicTabbedPaneUI
org.pushingpixels.substance.internal.ui.SubstanceTabbedPaneUI
- All Implemented Interfaces:
SwingConstants
UI for tabbed panes in Substance look and feel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Listener for rollover animation effects.protected final class
Tracks changes to the tabbed pane contents.class
Layout for the tabbed pane.protected class
Implementation of the fade tracker callback that repaints a single tab.Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionTracks changes to the tabbed pane contents.protected Point
Current mouse location.Mouse handler for rollover effects.protected ChangeListener
Listener for animation effects on tab selection.Fields inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
calcRect, contentBorderInsets, darkShadow, downKey, focus, focusListener, highlight, leftKey, lightHighlight, maxTabHeight, maxTabWidth, mouseListener, propertyChangeListener, rects, rightKey, runCount, selectedRun, selectedTabPadInsets, shadow, tabAreaInsets, tabChangeListener, tabInsets, tabPane, tabRunOverlay, tabRuns, textIconGap, upKey
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
calculateMaxTabHeight
(int tabPlacement) protected int
calculateTabHeight
(int tabPlacement, int tabIndex, int fontHeight) protected int
calculateTabWidth
(int tabPlacement, int tabIndex, FontMetrics metrics) protected LayoutManager
protected MouseListener
protected JButton
createScrollButton
(int direction) static ComponentUI
createUI
(JComponent comp) protected void
Ensures the current layout.protected Rectangle
getCloseButtonRectangleForDraw
(int tabIndex, int x, int y, int width, int height) Retrieves the close button rectangle for drawing purposes.protected Rectangle
getCloseButtonRectangleForEvents
(int tabIndex, int x, int y, int w, int h) Retrieves the close button rectangle for event handling.protected Insets
getContentBorderInsets
(int tabPlacement) static String
Returns the memory usage string.protected StateTransitionTracker.ModelStateInfo
getModelStateInfo
(int tabIndex) int
Returns the index of the tab currently being rolled-over.Returns tab area insets.getTabBounds
(JTabbedPane pane, int i) protected int
getTabExtraWidth
(int tabPlacement, int tabIndex) Returns extra width for the specified tab.protected int
getTabLabelShiftX
(int tabPlacement, int tabIndex, boolean isSelected) protected int
getTabLabelShiftY
(int tabPlacement, int tabIndex, boolean isSelected) getTabRectangle
(int tabIndex) Returns the tab rectangle for the specified tab.protected int
getTabRunOverlay
(int tabPlacement) protected ComponentState
getTabState
(int tabIndex) Returns the current state for the specified tab.protected void
protected void
void
paint
(Graphics g, JComponent c) protected void
paintContentBorder
(Graphics g, int tabPlacement, int selectedIndex) protected void
paintContentBorderBottomEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected void
paintContentBorderLeftEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected void
paintContentBorderRightEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected void
paintContentBorderTopEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) protected void
paintFocusIndicator
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) protected void
paintIcon
(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) protected void
paintTab
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) protected void
paintTabArea
(Graphics g, int tabPlacement, int selectedIndex) protected void
paintTabBackground
(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) protected void
paintTabBorder
(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) protected void
paintText
(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) void
setTabAreaInsets
(Insets insets) Sets new value for tab area insets.protected boolean
shouldPadTabRun
(int tabPlacement, int run) protected boolean
toRotateTabsOnPlacement
(int tabPlacement) Extension point to allow horizontal orientation of left / right placed tabs.protected void
tryCloseTab
(int tabIndex) Tries closing a single tab.protected void
tryCloseTabs
(int tabIndex, SubstanceConstants.TabCloseKind tabCloseKind) Tries closing tabs based on the specified tab index and tab close kind.protected void
tryCloseTabs
(Set<Integer> tabIndexes) Tries closing the specified tabs.protected void
protected void
Methods inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, createChangeListener, createFocusListener, createPropertyChangeListener, expandTabRunsArray, getBaseline, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installUI, lastTabInRun, layoutLabel, navigateSelectedTab, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallKeyboardActions, uninstallUI
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, update
-
Field Details
-
substanceMouseLocation
Current mouse location. -
substanceRolloverHandler
Mouse handler for rollover effects. -
substanceContainerListener
Tracks changes to the tabbed pane contents. Each tab component is tracked for changes on theSubstanceLookAndFeel.WINDOW_MODIFIED
property. -
substanceSelectionListener
Listener for animation effects on tab selection.
-
-
Constructor Details
-
SubstanceTabbedPaneUI
public SubstanceTabbedPaneUI()Creates the new UI delegate.
-
-
Method Details
-
createUI
-
installListeners
protected void installListeners()- Overrides:
installListeners
in classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()- Overrides:
uninstallListeners
in classBasicTabbedPaneUI
-
installDefaults
protected void installDefaults()- Overrides:
installDefaults
in classBasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()- Overrides:
uninstallDefaults
in classBasicTabbedPaneUI
-
paintTabBackground
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - Overrides:
paintTabBackground
in classBasicTabbedPaneUI
-
paintFocusIndicator
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) - Overrides:
paintFocusIndicator
in classBasicTabbedPaneUI
-
paintTabBorder
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) - Overrides:
paintTabBorder
in classBasicTabbedPaneUI
-
createScrollButton
- Overrides:
createScrollButton
in classBasicTabbedPaneUI
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) - Overrides:
calculateTabHeight
in classBasicTabbedPaneUI
-
calculateTabWidth
- Overrides:
calculateTabWidth
in classBasicTabbedPaneUI
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement) - Overrides:
calculateMaxTabHeight
in classBasicTabbedPaneUI
-
getTabRunOverlay
protected int getTabRunOverlay(int tabPlacement) - Overrides:
getTabRunOverlay
in classBasicTabbedPaneUI
-
paint
- Overrides:
paint
in classBasicTabbedPaneUI
-
paintTab
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) - Overrides:
paintTab
in classBasicTabbedPaneUI
-
paintTabArea
- Overrides:
paintTabArea
in classBasicTabbedPaneUI
-
getCloseButtonRectangleForDraw
protected Rectangle getCloseButtonRectangleForDraw(int tabIndex, int x, int y, int width, int height) Retrieves the close button rectangle for drawing purposes.- Parameters:
tabIndex
- Tab index.x
- X coordinate of the tab.y
- Y coordinate of the tab.width
- The tab width.height
- The tab height.- Returns:
- The close button rectangle.
-
getCloseButtonRectangleForEvents
Retrieves the close button rectangle for event handling.- Parameters:
tabIndex
- Tab index.x
- X coordinate of the tab.y
- Y coordinate of the tab.w
- The tab width.h
- The tab height.- Returns:
- The close button rectangle.
-
ensureCurrentLayout
protected void ensureCurrentLayout()Ensures the current layout. -
tryCloseTabs
Tries closing tabs based on the specified tab index and tab close kind.- Parameters:
tabIndex
- Tab index.tabCloseKind
- Tab close kind.
-
tryCloseTab
protected void tryCloseTab(int tabIndex) Tries closing a single tab.- Parameters:
tabIndex
- Tab index.
-
tryCloseTabs
Tries closing the specified tabs.- Parameters:
tabIndexes
- Tab indexes.
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) - Overrides:
getTabLabelShiftX
in classBasicTabbedPaneUI
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) - Overrides:
getTabLabelShiftY
in classBasicTabbedPaneUI
-
getTabExtraWidth
protected int getTabExtraWidth(int tabPlacement, int tabIndex) Returns extra width for the specified tab.- Parameters:
tabPlacement
- Tab placement.tabIndex
- Tab index.- Returns:
- Extra width for the specified tab.
-
getRolloverTabIndex
public int getRolloverTabIndex()Returns the index of the tab currently being rolled-over.- Returns:
- Index of the tab currently being rolled-over.
-
setTabAreaInsets
Sets new value for tab area insets.- Parameters:
insets
- Tab area insets.
-
getTabAreaInsets
Returns tab area insets.- Returns:
- Tab area insets.
-
getTabRectangle
Returns the tab rectangle for the specified tab.- Parameters:
tabIndex
- Index of a tab.- Returns:
- The tab rectangle for the specified parameters.
-
getMemoryUsage
Returns the memory usage string.- Returns:
- The memory usage string.
-
shouldPadTabRun
protected boolean shouldPadTabRun(int tabPlacement, int run) - Overrides:
shouldPadTabRun
in classBasicTabbedPaneUI
-
createLayoutManager
- Overrides:
createLayoutManager
in classBasicTabbedPaneUI
-
getContentBorderInsets
- Overrides:
getContentBorderInsets
in classBasicTabbedPaneUI
-
paintContentBorder
- Overrides:
paintContentBorder
in classBasicTabbedPaneUI
-
paintContentBorderBottomEdge
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderBottomEdge
in classBasicTabbedPaneUI
-
paintContentBorderLeftEdge
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderLeftEdge
in classBasicTabbedPaneUI
-
paintContentBorderRightEdge
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderRightEdge
in classBasicTabbedPaneUI
-
paintContentBorderTopEdge
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) - Overrides:
paintContentBorderTopEdge
in classBasicTabbedPaneUI
-
getTabBounds
- Overrides:
getTabBounds
in classBasicTabbedPaneUI
-
getModelStateInfo
-
getTabState
Returns the current state for the specified tab.- Parameters:
tabIndex
- Tab index.- Returns:
- The current state for the specified tab.
-
paintText
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) - Overrides:
paintText
in classBasicTabbedPaneUI
-
paintIcon
protected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) - Overrides:
paintIcon
in classBasicTabbedPaneUI
-
createMouseListener
- Overrides:
createMouseListener
in classBasicTabbedPaneUI
-
toRotateTabsOnPlacement
protected boolean toRotateTabsOnPlacement(int tabPlacement) Extension point to allow horizontal orientation of left / right placed tabs.- Parameters:
tabPlacement
- Tab placement.- Returns:
- Indication whether the tabs in the specified placement should be rotated.
-