Class MetalTabbedPaneUI
- All Implemented Interfaces:
SwingConstants
public class MetalTabbedPaneUI extends BasicTabbedPaneUI
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.
Nested Class Summary
| Modifier and Type | Class | Description |
|---|---|---|
class |
MetalTabbedPaneUI.TabbedPaneLayout |
This class should be treated as a "protected" inner class. |
Nested classes/interfaces declared in class BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler | Modifier and Type | Class | Description |
|---|---|---|
class |
BasicTabbedPaneUI.FocusHandler |
This class should be treated as a "protected" inner class. |
class |
BasicTabbedPaneUI.MouseHandler |
This class should be treated as a "protected" inner class. |
class |
BasicTabbedPaneUI.PropertyChangeHandler |
This class should be treated as a "protected" inner class. |
class |
BasicTabbedPaneUI.TabSelectionHandler |
This class should be treated as a "protected" inner class. |
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
protected int |
minTabWidth |
The minimum width of a pane. |
protected Color |
selectColor |
The color of the selected pane. |
protected Color |
selectHighlight |
The color of the highlight. |
protected Color |
tabAreaBackground |
The color of tab's background. |
Fields declared in class 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 | Modifier and Type | Field | Description |
|---|---|---|
protected Rectangle |
calcRect |
A rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly. |
protected Insets |
contentBorderInsets |
Content border insets |
protected Color |
darkShadow |
Dark shadow color |
protected KeyStroke |
downKey |
Deprecated. As of Java 2 platform v1.3. |
protected Color |
focus |
Focus color |
protected FocusListener |
focusListener |
Focus change listener |
protected Color |
highlight |
Highlight color |
protected KeyStroke |
leftKey |
Deprecated. As of Java 2 platform v1.3. |
protected Color |
lightHighlight |
Light highlight color |
protected int |
maxTabHeight |
Maximum tab height |
protected int |
maxTabWidth |
Maximum tab width |
protected MouseListener |
mouseListener |
Mouse change listener |
protected PropertyChangeListener |
propertyChangeListener |
Property change listener |
protected Rectangle[] |
rects |
Tab rects |
protected KeyStroke |
rightKey |
Deprecated. As of Java 2 platform v1.3. |
protected int |
runCount |
Run count |
protected int |
selectedRun |
Selected run |
protected Insets |
selectedTabPadInsets |
Selected tab insets |
protected Color |
shadow |
Shadow color |
protected Insets |
tabAreaInsets |
Tab area insets |
protected ChangeListener |
tabChangeListener |
Tab change listener |
protected Insets |
tabInsets |
Tab insets |
protected JTabbedPane |
tabPane |
The tab pane |
protected int |
tabRunOverlay |
Tab run overlay |
protected int[] |
tabRuns |
Tab runs |
protected int |
textIconGap |
Text icon gap |
protected KeyStroke |
upKey |
Deprecated. As of Java 2 platform v1.3. |
Fields declared in interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST | Modifier and Type | Field | Description |
|---|---|---|
static final int |
BOTTOM |
Box-orientation constant used to specify the bottom of a box. |
static final int |
CENTER |
The central position in an area. |
static final int |
EAST |
Compass-direction east (right). |
static final int |
HORIZONTAL |
Horizontal orientation. |
static final int |
LEADING |
Identifies the leading edge of text for use with left-to-right and right-to-left languages. |
static final int |
LEFT |
Box-orientation constant used to specify the left side of a box. |
static final int |
NEXT |
Identifies the next direction in a sequence. |
static final int |
NORTH |
Compass-direction North (up). |
static final int |
NORTH_EAST |
Compass-direction north-east (upper right). |
static final int |
NORTH_WEST |
Compass-direction north west (upper left). |
static final int |
PREVIOUS |
Identifies the previous direction in a sequence. |
static final int |
RIGHT |
Box-orientation constant used to specify the right side of a box. |
static final int |
SOUTH |
Compass-direction south (down). |
static final int |
SOUTH_EAST |
Compass-direction south-east (lower right). |
static final int |
SOUTH_WEST |
Compass-direction south-west (lower left). |
static final int |
TOP |
Box-orientation constant used to specify the top of a box. |
static final int |
TRAILING |
Identifies the trailing edge of text for use with left-to-right and right-to-left languages. |
static final int |
VERTICAL |
Vertical orientation. |
static final int |
WEST |
Compass-direction west (left). |
Constructor Summary
| Constructor | Description |
|---|---|
MetalTabbedPaneUI() |
Constructs a MetalTabbedPaneUI. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static ComponentUI |
createUI |
Constructs MetalTabbedPaneUI. |
protected int |
getBaselineOffset() |
Returns the amount the baseline is offset by. |
protected Color |
getColorForGap |
Returns the color of the gap. |
protected int |
getTabLabelShiftX |
Overridden to do nothing for the Java L&F. |
protected int |
getTabLabelShiftY |
Overridden to do nothing for the Java L&F. |
protected void |
paintBottomTabBorder |
Paints the bottom tab border. |
protected void |
paintHighlightBelowTab() |
Paints highlights below tab. |
protected void |
paintLeftTabBorder |
Paints the left tab border. |
protected void |
paintRightTabBorder |
Paints the right tab border. |
protected void |
paintTopTabBorder |
Paints the top tab border. |
protected boolean |
shouldFillGap |
Returns true if the gap should be filled. |
protected boolean |
shouldRotateTabRuns |
Returns true if tab runs should be rotated. |
Methods declared in class BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabHeight, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, calculateTabWidth, createChangeListener, createFocusListener, createLayoutManager, createMouseListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineResizeBehavior, getContentBorderInsets, getFocusIndex, getFontMetrics, getIconForTab, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTabRunOverlay, getTextViewForTab, getVisibleComponent, installComponents, installDefaults, installKeyboardActions, installListeners, lastTabInRun, layoutLabel, navigateSelectedTab, paintContentBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintFocusIndicator, paintIcon, paintTab, paintTabArea, paintTabBackground, paintTabBorder, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldPadTabRun, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners | Modifier and Type | Method | Description |
|---|---|---|
protected void |
assureRectsCreated |
Assures the tab rectangles are created. |
protected int |
calculateMaxTabHeight |
Calculates the maximum tab height. |
protected int |
calculateMaxTabWidth |
Calculates the maximum tab width. |
protected int |
calculateTabAreaHeight |
Calculates the tab area height. |
protected int |
calculateTabAreaWidth |
Calculates the tab area width. |
protected int |
calculateTabHeight |
Calculates the tab height. |
protected int |
calculateTabWidth |
Calculates the tab width. |
protected ChangeListener |
createChangeListener() |
Creates a change listener. |
protected FocusListener |
createFocusListener() |
Creates a focus listener. |
protected LayoutManager |
createLayoutManager() |
Invoked by installUI to create a layout manager object to manage the JTabbedPane. |
protected MouseListener |
createMouseListener() |
Creates a mouse listener. |
protected PropertyChangeListener |
createPropertyChangeListener() |
Creates a property change listener. |
protected JButton |
createScrollButton |
Creates and returns a JButton that will provide the user with a way to scroll the tabs in a particular direction. |
protected void |
expandTabRunsArray() |
Expands the tab runs array. |
protected int |
getBaseline |
Returns the baseline for the specified tab. |
int |
getBaseline |
Returns the baseline. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior |
Returns an enum indicating how the baseline of the component changes as the size changes. |
protected Insets |
getContentBorderInsets |
Returns the content border insets. |
protected int |
getFocusIndex() |
Returns the index of the tab that has focus. |
protected FontMetrics |
getFontMetrics() |
Returns the font metrics. |
protected Icon |
getIconForTab |
Returns the icon for a tab. |
protected int |
getNextTabIndex |
Returns the next tab index. |
protected int |
getNextTabIndexInRun |
Returns the next tab index in the run. |
protected int |
getNextTabRun |
Returns the next tab run. |
protected int |
getPreviousTabIndex |
Returns the previous tab index. |
protected int |
getPreviousTabIndexInRun |
Returns the previous tab index in the run. |
protected int |
getPreviousTabRun |
Returns the previous tab run. |
protected int |
getRolloverTab() |
Returns the tab the mouse is currently over, or -1 if the mouse is no longer over any tab. |
protected int |
getRunForTab |
Returns the run for a tab. |
protected Insets |
getSelectedTabPadInsets |
Returns the selected tab pad insets. |
protected Insets |
getTabAreaInsets |
Returns the tab area insets. |
protected Rectangle |
getTabBounds |
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component. |
Rectangle |
getTabBounds |
Returns the bounds of the specified tab index. |
protected Insets |
getTabInsets |
Returns the tab insets. |
int |
getTabRunCount |
Returns the tab run count. |
protected int |
getTabRunIndent |
Returns the tab run indent. |
protected int |
getTabRunOffset |
Returns the tab run offset. |
protected int |
getTabRunOverlay |
Returns the tab run overlay. |
protected View |
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. |
protected Component |
getVisibleComponent() |
Returns the visible component. |
protected void |
installComponents() |
Creates and installs any required subcomponents for the JTabbedPane. |
protected void |
installDefaults() |
Installs the defaults. |
protected void |
installKeyboardActions() |
Installs the keyboard actions. |
protected void |
installListeners() |
Installs the listeners. |
protected int |
lastTabInRun |
Returns the last tab in a run. |
protected void |
layoutLabel |
Lays out a label. |
protected void |
navigateSelectedTab |
Navigates the selected tab. |
protected void |
paintContentBorder |
Paints the content border. |
protected void |
paintContentBorderBottomEdge |
Paints the content border bottom edge. |
protected void |
paintContentBorderLeftEdge |
Paints the content border left edge. |
protected void |
paintContentBorderRightEdge |
Paints the content border right edge. |
protected void |
paintContentBorderTopEdge |
Paints the content border top edge. |
protected void |
paintFocusIndicator |
Paints the focus indicator. |
protected void |
paintIcon |
Paints an icon. |
protected void |
paintTab |
Paints a tab. |
protected void |
paintTabArea |
Paints the tabs in the tab area. |
protected void |
paintTabBackground |
Paints the tab background. |
protected void |
paintTabBorder |
Paints the border around a tab. |
protected void |
paintText |
Paints text. |
protected static void |
rotateInsets |
Rotates the insets. |
protected void |
selectAdjacentRunTab |
Selects an adjacent run of tabs. |
protected void |
selectNextTab |
Selects the next tab. |
protected void |
selectNextTabInRun |
Selects the next tab in the run. |
protected void |
selectPreviousTab |
Selects the previous tab. |
protected void |
selectPreviousTabInRun |
Selects the previous tab in the run. |
protected void |
setRolloverTab |
Sets the tab the mouse is currently over to index. |
protected void |
setVisibleComponent |
Sets the visible component. |
protected boolean |
shouldPadTabRun |
Returns whether or not the tab run should be padded. |
protected boolean |
shouldRotateTabRuns |
Returns whether or not the tab run should be rotated. |
int |
tabForCoordinate |
Returns the tab index which intersects the specified point in the JTabbedPane's coordinate space. |
protected void |
uninstallComponents() |
Removes any installed subcomponents from the JTabbedPane. |
protected void |
uninstallDefaults() |
Uninstalls the defaults. |
protected void |
uninstallKeyboardActions() |
Uninstalls the keyboard actions. |
protected void |
uninstallListeners() |
Uninstalls the listeners. |
Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update | Modifier and Type | Method | Description |
|---|---|---|
boolean |
contains |
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component. |
Accessible |
getAccessibleChild |
Returns the ith Accessible child of the object. |
int |
getAccessibleChildrenCount |
Returns the number of accessible children in the object. |
Dimension |
getMaximumSize |
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
getMinimumSize |
Returns the specified component's minimum size appropriate for the look and feel. |
Dimension |
getPreferredSize |
Returns the specified component's preferred size appropriate for the look and feel. |
void |
installUI |
Configures the specified component appropriately for the look and feel. |
void |
paint |
Paints the specified component appropriately for the look and feel. |
void |
uninstallUI |
Reverses configuration which was done on the specified component during installUI. |
void |
update |
Notifies this UI delegate that it is time to paint the specified component. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Field Details
minTabWidth
protected int minTabWidth
tabAreaBackground
protected Color tabAreaBackground
selectColor
protected Color selectColor
selectHighlight
protected Color selectHighlight
Constructor Details
MetalTabbedPaneUI
public MetalTabbedPaneUI()
MetalTabbedPaneUI.Method Details
createUI
public static ComponentUI createUI(JComponent x)
MetalTabbedPaneUI.- Parameters:
-
x- a component - Returns:
- an instance of
MetalTabbedPaneUI
paintTopTabBorder
protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
- Parameters:
-
tabIndex- a tab index -
g- an instance ofGraphics -
x- an X coordinate -
y- an Y coordinate -
w- a width -
h- a height -
btm- bottom -
rght- right -
isSelected- a selection
shouldFillGap
protected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
true if the gap should be filled.- Parameters:
-
currentRun- the current run -
tabIndex- the tab index -
x- an X coordinate -
y- an Y coordinate - Returns:
-
trueif the gap should be filled
getColorForGap
protected Color getColorForGap(int currentRun, int x, int y)
- Parameters:
-
currentRun- the current run -
x- an X coordinate -
y- an Y coordinate - Returns:
- the color of the gap
paintLeftTabBorder
protected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
- Parameters:
-
tabIndex- a tab index -
g- an instance ofGraphics -
x- an X coordinate -
y- an Y coordinate -
w- a width -
h- a height -
btm- bottom -
rght- right -
isSelected- a selection
paintBottomTabBorder
protected void paintBottomTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
- Parameters:
-
tabIndex- a tab index -
g- an instance ofGraphics -
x- an X coordinate -
y- an Y coordinate -
w- a width -
h- a height -
btm- bottom -
rght- right -
isSelected- a selection
paintRightTabBorder
protected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
- Parameters:
-
tabIndex- a tab index -
g- an instance ofGraphics -
x- an X coordinate -
y- an Y coordinate -
w- a width -
h- a height -
btm- bottom -
rght- right -
isSelected- a selection
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
- Overrides:
-
getTabLabelShiftXin classBasicTabbedPaneUI - Parameters:
-
tabPlacement- the tab placement -
tabIndex- the tab index -
isSelected- selection status - Returns:
- the tab label shift x
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
- Overrides:
-
getTabLabelShiftYin classBasicTabbedPaneUI - Parameters:
-
tabPlacement- the tab placement -
tabIndex- the tab index -
isSelected- selection status - Returns:
- the tab label shift y
getBaselineOffset
protected int getBaselineOffset()
getTabLabelShiftY.- Overrides:
-
getBaselineOffsetin classBasicTabbedPaneUI - Returns:
- amount to offset the baseline by
- Since:
- 1.6
paintHighlightBelowTab
protected void paintHighlightBelowTab()
shouldRotateTabRuns
protected boolean shouldRotateTabRuns(int tabPlacement, int selectedRun)
true if tab runs should be rotated.- Parameters:
-
tabPlacement- a tab placement -
selectedRun- a selected run - Returns:
-
trueif tab runs should be rotated.
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.