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
.
Modifier and Type | Class and Description |
---|---|
class |
MetalTabbedPaneUI.TabbedPaneLayout
This class should be treated as a "protected" inner class.
|
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler
Modifier and Type | Field and 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.
|
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
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
MetalTabbedPaneUI() |
Modifier and Type | Method and Description |
---|---|
protected int |
calculateMaxTabHeight(int tabPlacement)
Calculates the maximum tab height.
|
protected LayoutManager |
createLayoutManager()
Invoked by
installUI to create
a layout manager object to manage
the JTabbedPane . |
static ComponentUI |
createUI(JComponent x)
Constructs
MetalTabbedPaneUI . |
protected int |
getBaselineOffset()
Returns the amount the baseline is offset by.
|
protected Color |
getColorForGap(int currentRun,
int x,
int y)
Returns the color of the gap.
|
protected int |
getTabLabelShiftX(int tabPlacement,
int tabIndex,
boolean isSelected)
Overridden to do nothing for the Java L&F.
|
protected int |
getTabLabelShiftY(int tabPlacement,
int tabIndex,
boolean isSelected)
Overridden to do nothing for the Java L&F.
|
protected int |
getTabRunOverlay(int tabPlacement)
Returns the tab run overlay.
|
protected void |
installDefaults()
Install the defaults.
|
void |
paint(Graphics g,
JComponent c)
Paints the specified component appropriately for the look and feel.
|
protected void |
paintBottomTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the bottom tab border.
|
protected void |
paintContentBorderBottomEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the content border bottom edge.
|
protected void |
paintContentBorderLeftEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the content border left edge.
|
protected void |
paintContentBorderRightEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the content border right edge.
|
protected void |
paintContentBorderTopEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the content border top edge.
|
protected void |
paintFocusIndicator(Graphics g,
int tabPlacement,
Rectangle[] rects,
int tabIndex,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
Paints the focus indicator.
|
protected void |
paintHighlightBelowTab()
Paints highlights below tab.
|
protected void |
paintLeftTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the left tab border.
|
protected void |
paintRightTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the right tab border.
|
protected void |
paintTabBackground(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
Paints the tab background.
|
protected void |
paintTabBorder(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
this function draws the border around each tab
note that this function does now draw the background of the tab.
|
protected void |
paintTopTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the top tab border.
|
protected boolean |
shouldFillGap(int currentRun,
int tabIndex,
int x,
int y)
Returns
true if the gap should be filled. |
protected boolean |
shouldPadTabRun(int tabPlacement,
int run)
Returns whether or not the tab run should be padded.
|
protected boolean |
shouldRotateTabRuns(int tabPlacement,
int selectedRun)
Returns
true if tab runs should be rotated. |
void |
update(Graphics g,
JComponent c)
Notifies this UI delegate that it is time to paint the specified
component.
|
assureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, calculateTabWidth, createChangeListener, createFocusListener, createMouseListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineResizeBehavior, getContentBorderInsets, getFocusIndex, getFontMetrics, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabInsets, getTabRunCount, getTabRunIndent, getTabRunOffset, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installListeners, installUI, lastTabInRun, layoutLabel, navigateSelectedTab, paintContentBorder, paintIcon, paintTab, paintTabArea, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize
protected int minTabWidth
protected Color tabAreaBackground
protected Color selectColor
protected Color selectHighlight
public static ComponentUI createUI(JComponent x)
MetalTabbedPaneUI
.x
- a componentMetalTabbedPaneUI
protected LayoutManager createLayoutManager()
BasicTabbedPaneUI
installUI
to create
a layout manager object to manage
the JTabbedPane
.createLayoutManager
in class BasicTabbedPaneUI
BasicTabbedPaneUI.TabbedPaneLayout
,
JTabbedPane.getTabLayoutPolicy()
protected void installDefaults()
BasicTabbedPaneUI
installDefaults
in class BasicTabbedPaneUI
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
BasicTabbedPaneUI
paintTabBorder
in class BasicTabbedPaneUI
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 paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
tabIndex
- a tab indexg
- an instance of Graphics
x
- an X coordinatey
- an Y coordinatew
- a widthh
- a heightbtm
- bottomrght
- rightisSelected
- a selectionprotected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
true
if the gap should be filled.currentRun
- the current runtabIndex
- the tab indexx
- an X coordinatey
- an Y coordinatetrue
if the gap should be filledprotected Color getColorForGap(int currentRun, int x, int y)
currentRun
- the current runx
- an X coordinatey
- an Y coordinateprotected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
tabIndex
- a tab indexg
- an instance of Graphics
x
- an X coordinatey
- an Y coordinatew
- a widthh
- a heightbtm
- bottomrght
- rightisSelected
- a selectionprotected void paintBottomTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
tabIndex
- a tab indexg
- an instance of Graphics
x
- an X coordinatey
- an Y coordinatew
- a widthh
- a heightbtm
- bottomrght
- rightisSelected
- a selectionprotected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
tabIndex
- a tab indexg
- an instance of Graphics
x
- an X coordinatey
- an Y coordinatew
- a widthh
- a heightbtm
- bottomrght
- rightisSelected
- a selectionpublic void update(Graphics g, JComponent c)
ComponentUI
JComponent
when the specified component is being painted.
By default this method fills the specified component with
its background color if its opaque
property is true
,
and then immediately calls paint
. In general this method need
not be overridden by subclasses; all look-and-feel rendering code should
reside in the paint
method.
update
in class ComponentUI
g
- the Graphics
context in which to paintc
- the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.paint(java.awt.Graphics, javax.swing.JComponent)
,
JComponent.paintComponent(java.awt.Graphics)
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
BasicTabbedPaneUI
paintTabBackground
in class BasicTabbedPaneUI
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 int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
getTabLabelShiftX
in class BasicTabbedPaneUI
tabPlacement
- the tab placementtabIndex
- the tab indexisSelected
- selection statusprotected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
getTabLabelShiftY
in class BasicTabbedPaneUI
tabPlacement
- the tab placementtabIndex
- the tab indexisSelected
- selection statusprotected int getBaselineOffset()
getTabLabelShiftY
.getBaselineOffset
in class BasicTabbedPaneUI
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update
method when
the specified component is being painted. Subclasses should override
this method and use the specified Graphics
object to
render the content of the component.paint
in class BasicTabbedPaneUI
g
- the Graphics
context in which to paintc
- the component being painted;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintHighlightBelowTab()
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
BasicTabbedPaneUI
paintFocusIndicator
in class BasicTabbedPaneUI
g
- the graphicstabPlacement
- the tab placementrects
- rectanglestabIndex
- the tab indexiconRect
- the icon rectangletextRect
- the text rectangleisSelected
- selection statusprotected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
BasicTabbedPaneUI
paintContentBorderTopEdge
in class BasicTabbedPaneUI
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)
BasicTabbedPaneUI
paintContentBorderBottomEdge
in class BasicTabbedPaneUI
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)
BasicTabbedPaneUI
paintContentBorderLeftEdge
in class BasicTabbedPaneUI
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)
BasicTabbedPaneUI
paintContentBorderRightEdge
in class BasicTabbedPaneUI
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 int calculateMaxTabHeight(int tabPlacement)
BasicTabbedPaneUI
calculateMaxTabHeight
in class BasicTabbedPaneUI
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected int getTabRunOverlay(int tabPlacement)
BasicTabbedPaneUI
getTabRunOverlay
in class BasicTabbedPaneUI
tabPlacement
- the placement (left, right, bottom, top) of the tabprotected boolean shouldRotateTabRuns(int tabPlacement, int selectedRun)
true
if tab runs should be rotated.tabPlacement
- a tab placementselectedRun
- a selected runtrue
if tab runs should be rotated.protected boolean shouldPadTabRun(int tabPlacement, int run)
BasicTabbedPaneUI
shouldPadTabRun
in class BasicTabbedPaneUI
tabPlacement
- the placement (left, right, bottom, top) of the tabrun
- the tab run Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait