SwingConstants
MetalTabbedPaneUI
, SynthTabbedPaneUI
public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
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.TabbedPaneLayout |
This class should be treated as a "protected" inner class. |
class |
BasicTabbedPaneUI.TabSelectionHandler |
This class should be treated as a "protected" inner class. |
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. |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor | Description |
---|---|
BasicTabbedPaneUI() |
Constructs a BasicTabbedPaneUI . |
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. |
static ComponentUI |
createUI |
Creates a UI. |
protected void |
expandTabRunsArray() |
Expands the tab runs array. |
protected int |
getBaseline |
Returns the baseline for the specified tab. |
int |
getBaseline |
Returns the baseline. |
protected int |
getBaselineOffset() |
Returns the amount the baseline is offset by. |
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. |
protected int |
getTabLabelShiftX |
Returns the tab label shift x. |
protected int |
getTabLabelShiftY |
Returns the tab label shift y. |
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. |
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
protected JTabbedPane tabPane
protected Color highlight
protected Color lightHighlight
protected Color shadow
protected Color darkShadow
protected Color focus
protected int textIconGap
protected int tabRunOverlay
protected Insets tabInsets
protected Insets selectedTabPadInsets
protected Insets tabAreaInsets
protected Insets contentBorderInsets
@Deprecated protected KeyStroke upKey
@Deprecated protected KeyStroke downKey
@Deprecated protected KeyStroke leftKey
@Deprecated protected KeyStroke rightKey
protected int[] tabRuns
protected int runCount
protected int selectedRun
protected Rectangle[] rects
protected int maxTabHeight
protected int maxTabWidth
protected ChangeListener tabChangeListener
protected PropertyChangeListener propertyChangeListener
protected MouseListener mouseListener
protected FocusListener focusListener
protected transient Rectangle calcRect
public BasicTabbedPaneUI()
BasicTabbedPaneUI
.public static ComponentUI createUI(JComponent c)
c
- a componentprotected LayoutManager createLayoutManager()
installUI
to create a layout manager object to manage the JTabbedPane
.protected void installComponents()
protected JButton createScrollButton(int direction)
direction
- One of the SwingConstants constants: SOUTH, NORTH, EAST or WESTIllegalArgumentException
- if direction is not one of NORTH, SOUTH, EAST or WESTprotected void uninstallComponents()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void uninstallListeners()
protected MouseListener createMouseListener()
protected FocusListener createFocusListener()
protected ChangeListener createChangeListener()
protected PropertyChangeListener createPropertyChangeListener()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
protected void setRolloverTab(int index)
index
. index
will be -1 if the mouse is no longer over any tab. No checking is done to ensure the passed in index identifies a valid tab.index
- Index of the tab the mouse is over.protected int getRolloverTab()
-1
if the mouse is no longer over any tab.-1
if the mouse is no longer over any tabpublic int getBaseline(JComponent c, int width, int height)
getBaseline
in class ComponentUI
c
- JComponent
baseline is being requested forwidth
- the width to get the baseline forheight
- the height to get the baseline forNullPointerException
- if c
is null
IllegalArgumentException
- if width or height is < 0public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
in class ComponentUI
c
- JComponent
to return baseline resize behavior forNullPointerException
- if c
is null
protected int getBaseline(int tab)
tab
- index of tab to get baseline forIndexOutOfBoundsException
- if index is out of range (index < 0 || index >= tab count)protected int getBaselineOffset()
getTabLabelShiftY
.protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
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.g
- the graphics object to use for renderingtabPlacement
- the placement for the tabs within the JTabbedPaneselectedIndex
- the tab index of the selected componentprotected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
g
- the graphicstabPlacement
- the tab placementrects
- the tab rectanglestabIndex
- the tab indexiconRect
- the icon rectangletextRect
- the text rectangleprotected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
tabPlacement
- the tab placementmetrics
- the font metricstabIndex
- the tab indextitle
- the titleicon
- the icontabRect
- the tab rectangleiconRect
- the icon rectangletextRect
- the text rectangleisSelected
- selection statusprotected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected)
g
- the graphicstabPlacement
- the tab placementtabIndex
- the tab indexicon
- the iconiconRect
- the icon rectangleisSelected
- selection statusprotected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
g
- the graphicstabPlacement
- the tab placementfont
- the fontmetrics
- the font metricstabIndex
- the tab indextitle
- the titletextRect
- the text rectangleisSelected
- selection statusprotected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
tabPlacement
- the tab placementtabIndex
- the tab indexisSelected
- selection statusprotected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
tabPlacement
- the tab placementtabIndex
- the tab indexisSelected
- selection statusprotected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
g
- the graphicstabPlacement
- the tab placementrects
- the tab rectanglestabIndex
- the tab indexiconRect
- the icon rectangletextRect
- the text rectangleisSelected
- selection statusprotected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the index of the tab with respect to other tabsx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabisSelected
- a boolean
which determines whether or not the tab is selectedprotected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the index of the tab with respect to other tabsx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabisSelected
- a boolean
which determines whether or not the tab is selectedprotected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabselectedIndex
- the tab index of the selected componentprotected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabselectedIndex
- the tab index of the selected componentx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabprotected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabselectedIndex
- the tab index of the selected componentx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabprotected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabselectedIndex
- the tab index of the selected componentx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabprotected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
g
- the graphics context in which to painttabPlacement
- the placement (left, right, bottom, top) of the tabselectedIndex
- the tab index of the selected componentx
- the x coordinate of taby
- the y coordinate of tabw
- the width of the tabh
- the height of the tabpublic Rectangle getTabBounds(JTabbedPane pane, int i)
getTabBounds
in class TabbedPaneUI
pane
- the panei
- the indexpublic int getTabRunCount(JTabbedPane pane)
TabbedPaneUI
getTabRunCount
in class TabbedPaneUI
pane
- the panepublic int tabForCoordinate(JTabbedPane pane, int x, int y)
tabForCoordinate
in class TabbedPaneUI
pane
- the panex
- the x coordinatey
- the y coordinateprotected Rectangle getTabBounds(int tabIndex, Rectangle dest)
Rectangle
instance. The handling of invalid parameters is unspecified.tabIndex
- the index of the tabdest
- the rectangle where the result should be placedprotected Component getVisibleComponent()
protected void setVisibleComponent(Component component)
component
- the componentprotected void assureRectsCreated(int tabCount)
tabCount
- the tab countprotected void expandTabRunsArray()
protected int getRunForTab(int tabCount, int tabIndex)
tabCount
- the tab counttabIndex
- the tab index.protected int lastTabInRun(int tabCount, int run)
tabCount
- the tab countrun
- the runprotected int getTabRunOverlay(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected int getTabRunIndent(int tabPlacement, int run)
tabPlacement
- the placement (left, right, bottom, top) of the tabrun
- the tab runprotected boolean shouldPadTabRun(int tabPlacement, int run)
tabPlacement
- the placement (left, right, bottom, top) of the tabrun
- the tab runprotected boolean shouldRotateTabRuns(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected Icon getIconForTab(int tabIndex)
tabIndex
- the index of the tabprotected View getTextViewForTab(int tabIndex)
tabIndex
- the index of the tabprotected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
tabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the index of the tab with respect to other tabsfontHeight
- the font heightprotected int calculateMaxTabHeight(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
tabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the index of the tab with respect to other tabsmetrics
- the font metricsprotected int calculateMaxTabWidth(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight)
tabPlacement
- the placement (left, right, bottom, top) of the tabhorizRunCount
- horizontal run countmaxTabHeight
- maximum tab heightprotected int calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth)
tabPlacement
- the placement (left, right, bottom, top) of the tabvertRunCount
- vertical run countmaxTabWidth
- maximum tab widthprotected Insets getTabInsets(int tabPlacement, int tabIndex)
tabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the tab indexprotected Insets getSelectedTabPadInsets(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected Insets getTabAreaInsets(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected Insets getContentBorderInsets(int tabPlacement)
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected FontMetrics getFontMetrics()
protected void selectNextTabInRun(int current)
current
- the current tabprotected void selectPreviousTabInRun(int current)
current
- the current tabprotected void selectNextTab(int current)
current
- the current tabprotected void selectPreviousTab(int current)
current
- the current tabprotected void selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset)
tabPlacement
- the placement (left, right, bottom, top) of the tabtabIndex
- the index of the tab with respect to other tabsoffset
- selection offsetprotected int getFocusIndex()
protected int getTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward)
tabPlacement
- the placement (left, right, bottom, top) of the tabtabCount
- the tab counttabIndex
- the index of the tab with respect to other tabsforward
- forward or notprotected int getPreviousTabIndex(int base)
base
- the baseprotected int getNextTabIndex(int base)
base
- the baseprotected int getNextTabIndexInRun(int tabCount, int base)
tabCount
- the tab countbase
- the baseprotected int getPreviousTabIndexInRun(int tabCount, int base)
tabCount
- the tab countbase
- the baseprotected int getPreviousTabRun(int baseRun)
baseRun
- the base runprotected int getNextTabRun(int baseRun)
baseRun
- the base runprotected static void rotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement)
topInsets
- the top insetstargetInsets
- the target insetstargetPlacement
- the target placement
© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/plaf/basic/BasicTabbedPaneUI.html