Class BaseTabbedPaneUI
- All Implemented Interfaces:
SwingConstants
- Direct Known Subclasses:
AcrylTabbedPaneUI
,AeroTabbedPaneUI
,AluminiumTabbedPaneUI
,BernsteinTabbedPaneUI
,FastTabbedPaneUI
,GraphiteTabbedPaneUI
,HiFiTabbedPaneUI
,LunaTabbedPaneUI
,McWinTabbedPaneUI
,MintTabbedPaneUI
,SmartTabbedPaneUI
,TextureTabbedPaneUI
- Version:
- 1.87 06/08/99 Author Amy Fowler Author Philip Milne Author Steve Wilson Author Tom Santos Author Dave Moore Author Michael Hagen
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
This inner class is marked "public" due to a compiler bug.class
This inner class is marked "public" due to a compiler bug.class
This inner class is marked "public" due to a compiler bug.class
class
This inner class is marked "public" due to a compiler bug.class
This inner class is marked "public" due to a compiler bug.class
static class
This inner class is marked "public" due to a compiler bug. -
Field Summary
Modifier and TypeFieldDescriptionprotected Rectangle
A rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly.protected Insets
protected FocusListener
protected static final int
Constant GAP=5protected int
protected int
protected MouseListener
protected MouseMotionListener
protected static final Insets
Constant NULL_BORDER_INSETSprotected int
protected PropertyChangeListener
protected Rectangle[]
protected int
protected boolean
protected int
protected Color
protected int
protected Insets
protected boolean
protected Color
protected Insets
protected ChangeListener
protected ComponentListener
protected Insets
protected JTabbedPane
protected int
protected int[]
protected int
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
assureRectsCreated
(int tabCount) assureRectsCreated.protected int
calculateMaxTabHeight
(int tabPlacement) calculateMaxTabHeight.protected int
calculateMaxTabWidth
(int tabPlacement) calculateMaxTabWidth.protected int
calculateTabAreaHeight
(int tabPlacement, int horizRunCount, int maxTabHeight) calculateTabAreaHeight.protected int
calculateTabAreaWidth
(int tabPlacement, int vertRunCount, int maxTabWidth) calculateTabAreaWidth.protected int
calculateTabHeight
(int tabPlacement, int tabIndex, int fontHeight) calculateTabHeight.protected int
calculateTabWidth
(int tabPlacement, int tabIndex, FontMetrics metrics) calculateTabWidth.protected ChangeListener
createChangeListener.protected ComponentListener
createComponentListener.protected FocusListener
createFocusListener.protected LayoutManager
Invoked by installUI to create a layout manager object to manage the JTabbedPane.protected MouseListener
createMouseListener.protected MouseMotionListener
createMouseMotionListener.protected PropertyChangeListener
createPropertyChangeListener.static ComponentUI
protected void
expandTabRunsArray.protected int
getClosestTab
(int x, int y) getClosestTab.protected Color
getContentBorderColor.protected Color[]
getContentBorderColors
(int tabPlacement) getContentBorderColors.protected Insets
getContentBorderInsets
(int tabPlacement) Getter for the field contentBorderInsets.protected FontMetrics
getFontMetrics.protected Color
getGapColor
(int tabIndex) getGapColor.protected Color
getHiBorderColor
(int tabIndex) getHiBorderColor.protected Icon
getIconForTab
(int tabIndex) getIconForTab.protected Color
getLoBorderColor
(int tabIndex) getLoBorderColor.protected int
getNextTabIndex
(int base) getNextTabIndex.protected int
getNextTabIndexInRun
(int tabCount, int base) getNextTabIndexInRun.protected int
getNextTabRun
(int baseRun) getNextTabRun.protected int
getPreviousTabIndex
(int base) getPreviousTabIndex.protected int
getPreviousTabIndexInRun
(int tabCount, int base) getPreviousTabIndexInRun.protected int
getPreviousTabRun
(int baseRun) getPreviousTabRun.protected int
getRunForTab
(int tabCount, int tabIndex) getRunForTab.protected Insets
getSelectedTabPadInsets
(int tabPlacement) Getter for the field selectedTabPadInsets.protected Insets
getTabAreaInsets
(int tabPlacement) Getter for the field tabAreaInsets.protected int
getTabAtLocation
(int x, int y) getTabAtLocation.protected Rectangle
getTabBounds
(int tabIndex, Rectangle dest) Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.getTabBounds
(JTabbedPane pane, int i) protected Color[]
getTabColors
(int tabIndex, boolean isSelected, boolean isRollover) getTabColors.protected Font
getTabFont
(boolean isSelected) getTabFont.protected Insets
getTabInsets
(int tabPlacement, int tabIndex) Getter for the field tabInsets.protected int
getTabLabelShiftX
(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftX.protected int
getTabLabelShiftY
(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftY.int
getTabRunCount
(JTabbedPane pane) protected int
getTabRunIndent
(int tabPlacement, int run) getTabRunIndent.protected int
getTabRunOffset
(int tabPlacement, int tabCount, int tabIndex, boolean forward) getTabRunOffset.protected int
getTabRunOverlay
(int tabPlacement) Getter for the field tabRunOverlay.protected View
getTextViewForTab
(int tabIndex) Returns the text View object required to render stylized text (HTML) for the specified tab or null if no specialized text rendering is needed for this tab.protected Component
Getter for the field visibleComponent.protected boolean
hasInnerBorder.protected void
Creates and installs any required subcomponents for the JTabbedPane.protected void
installDefaults.protected void
installKeyboardActions.protected void
installListeners.void
protected boolean
isContentOpaque.protected boolean
isTabOpaque.protected int
lastTabInRun
(int tabCount, int run) lastTabInRun.protected void
layoutLabel
(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) layoutLabel.protected void
navigateSelectedTab
(int direction) navigateSelectedTab.void
paint
(Graphics g, JComponent c) protected void
paintBottomTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintBottomTabBorder.protected void
paintContentBorder
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintContentBorder.protected void
paintFocusIndicator
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) paintFocusIndicator.protected void
paintIcon
(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) paintIcon.protected void
paintLeftTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintLeftTabBorder.protected void
paintRightTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRightTabBorder.protected void
paintRoundedBottomTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedBottomTabBorder.protected void
paintRoundedTopTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedTopTabBorder.protected void
paintScrollContentBorder
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintScrollContentBorder.protected void
paintTab
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) paintTab.protected void
paintTabArea
(Graphics g, int tabPlacement, int selectedIndex) Paints the tabs in the tab area.protected void
paintTabBackground
(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBackground.protected void
paintTabBorder
(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBorder.protected void
paintText
(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) paintText.protected void
paintTopTabBorder
(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintTopTabBorder.protected boolean
requestFocusForVisibleComponent.protected static void
rotateInsets
(Insets topInsets, Insets targetInsets, int targetPlacement) rotateInsets.protected boolean
scrollableTabLayoutEnabled.protected void
selectAdjacentRunTab
(int tabPlacement, int tabIndex, int offset) selectAdjacentRunTab.protected void
selectNextTab
(int current) selectNextTab.protected void
selectNextTabInRun
(int current) selectNextTabInRun.protected void
selectPreviousTab
(int current) selectPreviousTab.protected void
selectPreviousTabInRun
(int current) selectPreviousTabInRun.protected void
setVisibleComponent
(Component component) Setter for the field visibleComponent.protected boolean
shouldPadTabRun
(int tabPlacement, int run) shouldPadTabRun.protected boolean
shouldRotateTabRuns
(int tabPlacement) shouldRotateTabRuns.int
tabForCoordinate
(JTabbedPane pane, int x, int y) protected void
Removes any installed subcomponents from the JTabbedPane.protected void
uninstallDefaults.protected void
uninstallKeyboardActions.protected void
uninstallListeners.void
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, update
-
Field Details
-
NULL_BORDER_INSETS
Constant NULL_BORDER_INSETS -
GAP
protected static final int GAPConstant GAP=5- See Also:
-
tabPane
-
tabAreaBackground
-
selectedColor
-
textIconGap
protected int textIconGap -
tabRunOverlay
protected int tabRunOverlay -
tabInsets
-
selectedTabPadInsets
-
tabAreaInsets
-
contentBorderInsets
-
tabRuns
protected int[] tabRuns -
runCount
protected int runCount -
selectedRun
protected int selectedRun -
rects
-
maxTabHeight
protected int maxTabHeight -
maxTabWidth
protected int maxTabWidth -
tabChangeListener
-
tabComponentListener
-
propertyChangeListener
-
mouseListener
-
mouseMotionListener
-
focusListener
-
calcRect
A rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly. -
oldRolloverIndex
protected int oldRolloverIndex -
rolloverIndex
protected int rolloverIndex -
roundedTabs
protected boolean roundedTabs -
simpleButtonBorder
protected boolean simpleButtonBorder
-
-
Constructor Details
-
BaseTabbedPaneUI
public BaseTabbedPaneUI()
-
-
Method Details
-
createUI
-
rotateInsets
rotateInsets.
-
assureRectsCreated
protected void assureRectsCreated(int tabCount) assureRectsCreated.
- Parameters:
tabCount
- aInteger
object.
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement) calculateMaxTabHeight.
-
calculateMaxTabWidth
protected int calculateMaxTabWidth(int tabPlacement) calculateMaxTabWidth.
-
calculateTabAreaHeight
protected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) calculateTabAreaHeight.
-
calculateTabAreaWidth
protected int calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth) calculateTabAreaWidth.
-
calculateTabHeight
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) calculateTabHeight.
-
calculateTabWidth
calculateTabWidth.
- Parameters:
tabPlacement
- aInteger
object.tabIndex
- aInteger
object.metrics
- aFontMetrics
object.- Returns:
- a
Integer
object.
-
createChangeListener
createChangeListener.
- Returns:
- a
ChangeListener
object.
-
createComponentListener
createComponentListener.
- Returns:
- a
ComponentListener
object.
-
createFocusListener
createFocusListener.
- Returns:
- a
FocusListener
object.
-
createLayoutManager
Invoked by installUI to create a layout manager object to manage the JTabbedPane.- Returns:
- a layout manager object
- See Also:
-
createMouseListener
createMouseListener.
- Returns:
- a
MouseListener
object.
-
createMouseMotionListener
createMouseMotionListener.
- Returns:
- a
MouseMotionListener
object.
-
createPropertyChangeListener
createPropertyChangeListener.
- Returns:
- a
PropertyChangeListener
object.
-
expandTabRunsArray
protected void expandTabRunsArray()expandTabRunsArray.
-
getClosestTab
protected int getClosestTab(int x, int y) getClosestTab.
-
getContentBorderColor
getContentBorderColor.
- Returns:
- a
Color
object.
-
getContentBorderColors
getContentBorderColors.
-
getContentBorderInsets
Getter for the field contentBorderInsets.
-
getFontMetrics
getFontMetrics.
- Returns:
- a
FontMetrics
object.
-
getGapColor
getGapColor.
-
getHiBorderColor
getHiBorderColor.
-
getIconForTab
getIconForTab.
-
getLoBorderColor
getLoBorderColor.
-
getMaximumSize
- Overrides:
getMaximumSize
in classComponentUI
-
getMinimumSize
- Overrides:
getMinimumSize
in classComponentUI
-
getNextTabIndex
protected int getNextTabIndex(int base) getNextTabIndex.
-
getNextTabIndexInRun
protected int getNextTabIndexInRun(int tabCount, int base) getNextTabIndexInRun.
-
getNextTabRun
protected int getNextTabRun(int baseRun) getNextTabRun.
-
getPreferredSize
- Overrides:
getPreferredSize
in classComponentUI
-
getPreviousTabIndex
protected int getPreviousTabIndex(int base) getPreviousTabIndex.
-
getPreviousTabIndexInRun
protected int getPreviousTabIndexInRun(int tabCount, int base) getPreviousTabIndexInRun.
-
getPreviousTabRun
protected int getPreviousTabRun(int baseRun) getPreviousTabRun.
-
getRunForTab
protected int getRunForTab(int tabCount, int tabIndex) getRunForTab.
-
getSelectedTabPadInsets
Getter for the field selectedTabPadInsets.
-
getTabAreaInsets
Getter for the field tabAreaInsets.
-
getTabAtLocation
protected int getTabAtLocation(int x, int y) getTabAtLocation.
-
getTabBounds
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component. This is required because the tab rects are by default defined in the coordinate space of the component where they are rendered, which could be the JTabbedPane (for WRAP_TAB_LAYOUT) or a ScrollableTabPanel (SCROLL_TAB_LAYOUT). This method should be used whenever the tab rectangle must be relative to the JTabbedPane itself and the result should be placed in a designated Rectangle object (rather than instantiating and returning a new Rectangle each time). The tab index parameter must be a valid tabbed pane tab index (0 to tab count - 1, inclusive). The destination rectangle parameter must be a valid Rectangle instance. The handling of invalid parameters is unspecified.- Parameters:
tabIndex
- the index of the tabdest
- the rectangle where the result should be placed- Returns:
- the resulting rectangle
- Since:
- 1.4
-
getTabBounds
- Specified by:
getTabBounds
in classTabbedPaneUI
-
getTabColors
getTabColors.
-
getTabFont
getTabFont.
- Parameters:
isSelected
- a boolean.- Returns:
- a
Font
object.
-
getTabInsets
Getter for the field tabInsets.
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftX.
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftY.
-
getTabRunCount
- Specified by:
getTabRunCount
in classTabbedPaneUI
-
getTabRunIndent
protected int getTabRunIndent(int tabPlacement, int run) getTabRunIndent.
-
getTabRunOffset
protected int getTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward) getTabRunOffset.
-
getTabRunOverlay
protected int getTabRunOverlay(int tabPlacement) Getter for the field tabRunOverlay.
-
getTextViewForTab
Returns the text View object required to render stylized text (HTML) for the specified tab or null if no specialized text rendering is needed for this tab. This is provided to support html rendering inside tabs.- Parameters:
tabIndex
- the index of the tab- Returns:
- the text view to render the tab's text or null if no specialized rendering is required
- Since:
- 1.4
-
getVisibleComponent
Getter for the field visibleComponent.
- Returns:
- a
Component
object.
-
hasInnerBorder
protected boolean hasInnerBorder()hasInnerBorder.
- Returns:
- a boolean.
-
installComponents
protected void installComponents()Creates and installs any required subcomponents for the JTabbedPane. Invoked by installUI.- Since:
- 1.4
-
installDefaults
protected void installDefaults()installDefaults.
-
installKeyboardActions
protected void installKeyboardActions()installKeyboardActions.
-
installListeners
protected void installListeners()installListeners.
-
installUI
- Overrides:
installUI
in classComponentUI
-
isContentOpaque
protected boolean isContentOpaque()isContentOpaque.
- Returns:
- a boolean.
-
isTabOpaque
protected boolean isTabOpaque()isTabOpaque.
- Returns:
- a boolean.
-
lastTabInRun
protected int lastTabInRun(int tabCount, int run) lastTabInRun.
-
layoutLabel
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) layoutLabel.
-
paint
- Overrides:
paint
in classComponentUI
-
paintBottomTabBorder
protected void paintBottomTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintBottomTabBorder.
-
paintContentBorder
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintContentBorder.
-
paintFocusIndicator
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) paintFocusIndicator.
-
paintIcon
protected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) paintIcon.
-
paintLeftTabBorder
protected void paintLeftTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintLeftTabBorder.
-
paintRightTabBorder
protected void paintRightTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRightTabBorder.
-
paintRoundedBottomTabBorder
protected void paintRoundedBottomTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedBottomTabBorder.
-
paintRoundedTopTabBorder
protected void paintRoundedTopTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedTopTabBorder.
-
paintScrollContentBorder
protected void paintScrollContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintScrollContentBorder.
-
paintTab
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) paintTab.
-
paintTabArea
Paints the tabs in the tab area. Invoked by paint(). The graphics parameter must be a valid Graphics object. Tab placement may be either: JTabbedPane.TOP, JTabbedPane.BOTTOM, JTabbedPane.LEFT, or JTabbedPane.RIGHT. The selected index must be a valid tabbed pane tab index (0 to tab count - 1, inclusive) or -1 if no tab is currently selected. The handling of invalid parameters is unspecified.- Parameters:
g
- the graphics object to use for renderingtabPlacement
- the placement for the tabs within the JTabbedPaneselectedIndex
- the tab index of the selected component- Since:
- 1.4
-
paintTabBackground
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBackground.
-
paintTabBorder
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBorder.
-
paintText
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) paintText.
-
paintTopTabBorder
protected void paintTopTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintTopTabBorder.
-
requestFocusForVisibleComponent
protected boolean requestFocusForVisibleComponent()requestFocusForVisibleComponent.
- Returns:
- a boolean.
-
scrollableTabLayoutEnabled
protected boolean scrollableTabLayoutEnabled()scrollableTabLayoutEnabled.
- Returns:
- a boolean.
-
selectAdjacentRunTab
protected void selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset) selectAdjacentRunTab.
-
selectNextTab
protected void selectNextTab(int current) selectNextTab.
- Parameters:
current
- aInteger
object.
-
selectNextTabInRun
protected void selectNextTabInRun(int current) selectNextTabInRun.
- Parameters:
current
- aInteger
object.
-
selectPreviousTab
protected void selectPreviousTab(int current) selectPreviousTab.
- Parameters:
current
- aInteger
object.
-
selectPreviousTabInRun
protected void selectPreviousTabInRun(int current) selectPreviousTabInRun.
- Parameters:
current
- aInteger
object.
-
setVisibleComponent
Setter for the field visibleComponent.
- Parameters:
component
- aComponent
object.
-
shouldPadTabRun
protected boolean shouldPadTabRun(int tabPlacement, int run) shouldPadTabRun.
-
shouldRotateTabRuns
protected boolean shouldRotateTabRuns(int tabPlacement) shouldRotateTabRuns.
- Parameters:
tabPlacement
- aInteger
object.- Returns:
- a boolean.
-
tabForCoordinate
- Specified by:
tabForCoordinate
in classTabbedPaneUI
-
uninstallComponents
protected void uninstallComponents()Removes any installed subcomponents from the JTabbedPane. Invoked by uninstallUI.- Since:
- 1.4
-
uninstallDefaults
protected void uninstallDefaults()uninstallDefaults.
-
uninstallKeyboardActions
protected void uninstallKeyboardActions()uninstallKeyboardActions.
-
uninstallListeners
protected void uninstallListeners()uninstallListeners.
-
uninstallUI
- Overrides:
uninstallUI
in classComponentUI
-