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
Nested ClassesModifier and TypeClassDescriptionclassThis inner class is marked "public" due to a compiler bug.classThis inner class is marked "public" due to a compiler bug.classThis inner class is marked "public" due to a compiler bug.classclassThis inner class is marked "public" due to a compiler bug.classThis inner class is marked "public" due to a compiler bug.classstatic classThis inner class is marked "public" due to a compiler bug. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RectangleA rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly.protected Insetsprotected FocusListenerprotected static final intConstant GAP=5protected intprotected intprotected MouseListenerprotected MouseMotionListenerprotected static final InsetsConstant NULL_BORDER_INSETSprotected intprotected PropertyChangeListenerprotected Rectangle[]protected intprotected booleanprotected intprotected Colorprotected intprotected Insetsbooleanprotected Colorprotected Insetsprotected ChangeListenerprotected ComponentListenerprotected Insetsprotected JTabbedPaneprotected intprotected int[]protected intFields 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 voidassureRectsCreated(int tabCount) assureRectsCreated.protected intcalculateMaxTabHeight(int tabPlacement) calculateMaxTabHeight.protected intcalculateMaxTabWidth(int tabPlacement) calculateMaxTabWidth.protected intcalculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) calculateTabAreaHeight.protected intcalculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth) calculateTabAreaWidth.protected intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) calculateTabHeight.protected intcalculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) calculateTabWidth.protected ChangeListenercreateChangeListener.protected ComponentListenercreateComponentListener.protected FocusListenercreateFocusListener.protected LayoutManagerInvoked by installUI to create a layout manager object to manage the JTabbedPane.protected MouseListenercreateMouseListener.protected MouseMotionListenercreateMouseMotionListener.protected PropertyChangeListenercreatePropertyChangeListener.static ComponentUIprotected voidexpandTabRunsArray.intgetClosestTab(int x, int y) getClosestTab.protected ColorgetContentBorderColor.protected Color[]getContentBorderColors(int tabPlacement) getContentBorderColors.getContentBorderInsets(int tabPlacement) Getter for the field contentBorderInsets.protected FontMetricsgetFontMetrics.protected ColorgetGapColor(int tabIndex) getGapColor.protected ColorgetHiBorderColor(int tabIndex) getHiBorderColor.protected IcongetIconForTab(int tabIndex) getIconForTab.protected ColorgetLoBorderColor(int tabIndex) getLoBorderColor.protected intgetNextTabIndex(int base) getNextTabIndex.protected intgetNextTabIndexInRun(int tabCount, int base) getNextTabIndexInRun.protected intgetNextTabRun(int baseRun) getNextTabRun.protected intgetPreviousTabIndex(int base) getPreviousTabIndex.protected intgetPreviousTabIndexInRun(int tabCount, int base) getPreviousTabIndexInRun.protected intgetPreviousTabRun(int baseRun) getPreviousTabRun.protected intgetRunForTab(int tabCount, int tabIndex) getRunForTab.protected InsetsgetSelectedTabPadInsets(int tabPlacement) Getter for the field selectedTabPadInsets.protected InsetsgetTabAreaInsets(int tabPlacement) Getter for the field tabAreaInsets.protected intgetTabAtLocation(int x, int y) getTabAtLocation.protected RectanglegetTabBounds(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 FontgetTabFont(boolean isSelected) getTabFont.protected InsetsgetTabInsets(int tabPlacement, int tabIndex) Getter for the field tabInsets.protected intgetTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftX.protected intgetTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) getTabLabelShiftY.intgetTabRunCount(JTabbedPane pane) protected intgetTabRunIndent(int tabPlacement, int run) getTabRunIndent.protected intgetTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward) getTabRunOffset.protected intgetTabRunOverlay(int tabPlacement) Getter for the field tabRunOverlay.protected ViewgetTextViewForTab(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 ComponentGetter for the field visibleComponent.protected booleanhasInnerBorder.protected voidCreates and installs any required subcomponents for the JTabbedPane.protected voidinstallDefaults.protected voidinstallKeyboardActions.protected voidinstallListeners.voidprotected booleanisContentOpaque.protected booleanisTabOpaque.protected intlastTabInRun(int tabCount, int run) lastTabInRun.protected voidlayoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) layoutLabel.voidnavigateSelectedTab(int direction) navigateSelectedTab.voidpaint(Graphics g, JComponent c) protected voidpaintBottomTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintBottomTabBorder.protected voidpaintContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintContentBorder.protected voidpaintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) paintFocusIndicator.protected voidpaintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) paintIcon.protected voidpaintLeftTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintLeftTabBorder.protected voidpaintRightTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRightTabBorder.protected voidpaintRoundedBottomTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedBottomTabBorder.protected voidpaintRoundedTopTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintRoundedTopTabBorder.voidpaintScrollContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) paintScrollContentBorder.protected voidpaintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) paintTab.voidpaintTabArea(Graphics g, int tabPlacement, int selectedIndex) Paints the tabs in the tab area.protected voidpaintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBackground.protected voidpaintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) paintTabBorder.protected voidpaintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) paintText.protected voidpaintTopTabBorder(int tabIndex, Graphics g, int x1, int y1, int x2, int y2, boolean isSelected) paintTopTabBorder.booleanrequestFocusForVisibleComponent.protected static voidrotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement) rotateInsets.booleanscrollableTabLayoutEnabled.protected voidselectAdjacentRunTab(int tabPlacement, int tabIndex, int offset) selectAdjacentRunTab.protected voidselectNextTab(int current) selectNextTab.protected voidselectNextTabInRun(int current) selectNextTabInRun.protected voidselectPreviousTab(int current) selectPreviousTab.protected voidselectPreviousTabInRun(int current) selectPreviousTabInRun.protected voidsetVisibleComponent(Component component) Setter for the field visibleComponent.protected booleanshouldPadTabRun(int tabPlacement, int run) shouldPadTabRun.protected booleanshouldRotateTabRuns(int tabPlacement) shouldRotateTabRuns.inttabForCoordinate(JTabbedPane pane, int x, int y) protected voidRemoves any installed subcomponents from the JTabbedPane.protected voiduninstallDefaults.protected voiduninstallKeyboardActions.protected voiduninstallListeners.voidMethods 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
-
mnemonicToIndexMap
-
tabScroller
-
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
public boolean simpleButtonBorder
-
-
Constructor Details
-
BaseTabbedPaneUI
public BaseTabbedPaneUI()
-
-
Method Details
-
createUI
-
rotateInsets
rotateInsets.
-
assureRectsCreated
protected void assureRectsCreated(int tabCount) assureRectsCreated.
- Parameters:
tabCount- aIntegerobject.
-
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- aIntegerobject.tabIndex- aIntegerobject.metrics- aFontMetricsobject.- Returns:
- a
Integerobject.
-
createChangeListener
createChangeListener.
- Returns:
- a
ChangeListenerobject.
-
createComponentListener
createComponentListener.
- Returns:
- a
ComponentListenerobject.
-
createFocusListener
createFocusListener.
- Returns:
- a
FocusListenerobject.
-
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
MouseListenerobject.
-
createMouseMotionListener
createMouseMotionListener.
- Returns:
- a
MouseMotionListenerobject.
-
createPropertyChangeListener
createPropertyChangeListener.
- Returns:
- a
PropertyChangeListenerobject.
-
expandTabRunsArray
protected void expandTabRunsArray()expandTabRunsArray.
-
getClosestTab
public int getClosestTab(int x, int y) getClosestTab.
-
getContentBorderColor
getContentBorderColor.
- Returns:
- a
Colorobject.
-
getContentBorderColors
getContentBorderColors.
-
getContentBorderInsets
Getter for the field contentBorderInsets.
-
getFontMetrics
getFontMetrics.
- Returns:
- a
FontMetricsobject.
-
getGapColor
getGapColor.
-
getHiBorderColor
getHiBorderColor.
-
getIconForTab
getIconForTab.
-
getLoBorderColor
getLoBorderColor.
-
getMaximumSize
- Overrides:
getMaximumSizein classComponentUI
-
getMinimumSize
- Overrides:
getMinimumSizein 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:
getPreferredSizein 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:
getTabBoundsin classTabbedPaneUI
-
getTabColors
getTabColors.
-
getTabFont
getTabFont.
- Parameters:
isSelected- a boolean.- Returns:
- a
Fontobject.
-
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:
getTabRunCountin 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
Componentobject.
-
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:
installUIin 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:
paintin 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
public 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
public boolean requestFocusForVisibleComponent()requestFocusForVisibleComponent.
- Returns:
- a boolean.
-
scrollableTabLayoutEnabled
public 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- aIntegerobject.
-
selectNextTabInRun
protected void selectNextTabInRun(int current) selectNextTabInRun.
- Parameters:
current- aIntegerobject.
-
selectPreviousTab
protected void selectPreviousTab(int current) selectPreviousTab.
- Parameters:
current- aIntegerobject.
-
selectPreviousTabInRun
protected void selectPreviousTabInRun(int current) selectPreviousTabInRun.
- Parameters:
current- aIntegerobject.
-
setVisibleComponent
Setter for the field visibleComponent.
- Parameters:
component- aComponentobject.
-
shouldPadTabRun
protected boolean shouldPadTabRun(int tabPlacement, int run) shouldPadTabRun.
-
shouldRotateTabRuns
protected boolean shouldRotateTabRuns(int tabPlacement) shouldRotateTabRuns.
- Parameters:
tabPlacement- aIntegerobject.- Returns:
- a boolean.
-
tabForCoordinate
- Specified by:
tabForCoordinatein 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:
uninstallUIin classComponentUI
-