APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.metal

public Class MetalTabbedPaneUI

extends BasicTabbedPaneUI
Class Inheritance
Imports
javax.swing.*, javax.swing.event.*, java.awt.*, java.awt.event.*, javax.swing.plaf.*, java.io.Serializable, javax.swing.plaf.basic.BasicTabbedPaneUI

The Metal subclass of 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 java.beans.XMLEncoder.

Author
Tom Santos

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class
MetalTabbedPaneUI.TabbedPaneLayout

This class should be treated as a "protected" inner class.

Field Summary

Modifier and TypeField and Description
protected int
minTabWidth

The minimum width of a pane.

private boolean
private Color
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.

private boolean
private Color
Inherited from javax.swing.plaf.basic.BasicTabbedPaneUI:
calcRectcontentBorderInsetsdarkShadowdownKeyfocusfocusListenerhighlightleftKeylightHighlightmaxTabHeightmaxTabWidthmouseListenerpropertyChangeListenerrectsrightKeyrunCountselectedRunselectedTabPadInsetsshadowtabAreaInsetstabChangeListenertabInsetstabPanetabRunOverlaytabRunstextIconGapupKey

Constructor Summary

AccessConstructor and Description
public
MetalTabbedPaneUI()

Constructs a MetalTabbedPaneUI.

Method Summary

Modifier and TypeMethod and Description
protected int
calculateMaxTabHeight(int tabPlacement)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabHeight.

Calculates the maximum tab height.

protected LayoutManager
createLayoutManager()

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.createLayoutManager.

Invoked by installUI to create a layout manager object to manage the JTabbedPane.

public static ComponentUI

Returns:

an instance of MetalTabbedPaneUI
createUI
(JComponent
a component
x
)

Hides javax.swing.plaf.basic.BasicTabbedPaneUI.createUI.

Constructs MetalTabbedPaneUI.

protected int
getBaselineOffset()

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getBaselineOffset.

Returns the amount the baseline is offset by.

protected Color

Returns:

the color of the gap
getColorForGap
(int
the current run
currentRun
,
int
an X coordinate
x
,
int
an Y coordinate
y
)

Returns the color of the gap.

pack-priv int
getRolloverTabIndex()

Returns the tab index of JTabbedPane the mouse is currently over

protected int
getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabLabelShiftX.

Overridden to do nothing for the Java L&F.

protected int
getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabLabelShiftY.

Overridden to do nothing for the Java L&F.

protected int
getTabRunOverlay(int tabPlacement)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabRunOverlay.

Returns the tab run overlay.

private Color
getUnselectedBackgroundAt(int index)

Returns the color to use for the specified tab.

protected void
private boolean
isLastInRun(int tabIndex)

public void
paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paint.

Paints the specified component appropriately for the look and feel.

protected void
paintBottomTabBorder(int
a tab index
tabIndex
,
Graphics
an instance of Graphics
g
,
int
an X coordinate
x
,
int
an Y coordinate
y
,
int
a width
w
,
int
a height
h
,
int
bottom
btm
,
int
right
rght
,
boolean
a selection
isSelected
)

Paints the bottom tab border.

protected void
paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderBottomEdge.

Paints the content border bottom edge.

protected void
paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderLeftEdge.

Paints the content border left edge.

protected void
paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderRightEdge.

Paints the content border right edge.

protected void
paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderTopEdge.

Paints the content border top edge.

protected void
paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintFocusIndicator.

Paints the focus indicator.

protected void
paintHighlightBelowTab()

Paints highlights below tab.

protected void
paintLeftTabBorder(int
a tab index
tabIndex
,
Graphics
an instance of Graphics
g
,
int
an X coordinate
x
,
int
an Y coordinate
y
,
int
a width
w
,
int
a height
h
,
int
bottom
btm
,
int
right
rght
,
boolean
a selection
isSelected
)

Paints the left tab border.

protected void
paintRightTabBorder(int
a tab index
tabIndex
,
Graphics
an instance of Graphics
g
,
int
an X coordinate
x
,
int
an Y coordinate
y
,
int
a width
w
,
int
a height
h
,
int
bottom
btm
,
int
right
rght
,
boolean
a selection
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)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBackground.

Paints the tab background.

protected void
paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBorder.

Paints the border around a tab.

protected void
paintTopTabBorder(int
a tab index
tabIndex
,
Graphics
an instance of Graphics
g
,
int
an X coordinate
x
,
int
an Y coordinate
y
,
int
a width
w
,
int
a height
h
,
int
bottom
btm
,
int
right
rght
,
boolean
a selection
isSelected
)

Paints the top tab border.

protected boolean

Returns:

true if the gap should be filled
shouldFillGap
(int
the current run
currentRun
,
int
the tab index
tabIndex
,
int
an X coordinate
x
,
int
an Y coordinate
y
)

Returns true if the gap should be filled.

protected boolean
shouldPadTabRun(int tabPlacement, int run)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.shouldPadTabRun.

Returns whether or not the tab run should be padded.

protected boolean

Returns:

true if tab runs should be rotated.
shouldRotateTabRuns
(int
a tab placement
tabPlacement
,
int
a selected run
selectedRun
)

Returns true if tab runs should be rotated.

public void
update(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.update.

Notifies this UI delegate that it is time to paint the specified component.

Inherited from javax.swing.plaf.basic.BasicTabbedPaneUI:
assureRectsCreatedcalculateMaxTabWidthcalculateTabAreaHeightcalculateTabAreaWidthcalculateTabHeightcalculateTabWidthcreateChangeListenercreateFocusListenercreateMouseListenercreatePropertyChangeListenercreateScrollButtonexpandTabRunsArraygetBaselinegetBaselinegetBaselineResizeBehaviorgetContentBorderInsetsgetFocusIndexgetFontMetricsgetIconForTabgetMaximumSizegetMinimumSizegetNextTabIndexgetNextTabIndexInRungetNextTabRungetPreviousTabIndexgetPreviousTabIndexInRungetPreviousTabRungetRolloverTabgetRunForTabgetSelectedTabPadInsetsgetTabAreaInsetsgetTabBoundsgetTabBoundsgetTabInsetsgetTabRunCountgetTabRunIndentgetTabRunOffsetgetTextViewForTabgetVisibleComponentinstallComponentsinstallKeyboardActionsinstallListenersinstallUIlastTabInRunlayoutLabelnavigateSelectedTabpaintContentBorderpaintIconpaintTabpaintTabAreapaintTextrotateInsetsselectAdjacentRunTabselectNextTabselectNextTabInRunselectPreviousTabselectPreviousTabInRunsetRolloverTabsetVisibleComponentshouldRotateTabRunstabForCoordinateuninstallComponentsuninstallDefaultsuninstallKeyboardActionsuninstallListenersuninstallUI

Field Detail

minTabWidthback to summary
protected int minTabWidth

The minimum width of a pane.

oceanback to summary
private boolean ocean
oceanSelectedBorderColorback to summary
private Color oceanSelectedBorderColor
selectColorback to summary
protected Color selectColor

The color of the selected pane.

selectHighlightback to summary
protected Color selectHighlight

The color of the highlight.

tabAreaBackgroundback to summary
protected Color tabAreaBackground

The color of tab's background.

tabsOpaqueback to summary
private boolean tabsOpaque

Hides javax.swing.plaf.basic.BasicTabbedPaneUI.tabsOpaque.

unselectedBackgroundback to summary
private Color unselectedBackground

Constructor Detail

MetalTabbedPaneUIback to summary
public MetalTabbedPaneUI()

Constructs a MetalTabbedPaneUI.

Method Detail

calculateMaxTabHeightback to summary
protected int calculateMaxTabHeight(int tabPlacement)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabHeight.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabHeight.

Calculates the maximum tab height.

createLayoutManagerback to summary
protected LayoutManager createLayoutManager()

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.createLayoutManager.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.createLayoutManager.

Invoked by installUI to create a layout manager object to manage the JTabbedPane.

createUIback to summary
public static ComponentUI createUI(JComponent x)

Hides javax.swing.plaf.basic.BasicTabbedPaneUI.createUI.

Constructs MetalTabbedPaneUI.

Parameters
x:JComponent

a component

Returns:ComponentUI

an instance of MetalTabbedPaneUI

getBaselineOffsetback to summary
protected int getBaselineOffset()

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getBaselineOffset.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.getBaselineOffset.

Returns the amount the baseline is offset by. This is typically the same as getTabLabelShiftY.

Since
1.6
getColorForGapback to summary
protected Color getColorForGap(int currentRun, int x, int y)

Returns the color of the gap.

Parameters
currentRun:int

the current run

x:int

an X coordinate

y:int

an Y coordinate

Returns:Color

the color of the gap

getRolloverTabIndexback to summary
pack-priv int getRolloverTabIndex()

Returns the tab index of JTabbedPane the mouse is currently over

getTabLabelShiftXback to summary
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabLabelShiftX.

Overridden to do nothing for the Java L&F.

getTabLabelShiftYback to summary
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabLabelShiftY.

Overridden to do nothing for the Java L&F.

getTabRunOverlayback to summary
protected int getTabRunOverlay(int tabPlacement)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.getTabRunOverlay.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.getTabRunOverlay.

Returns the tab run overlay.

getUnselectedBackgroundAtback to summary
private Color getUnselectedBackgroundAt(int index)

Returns the color to use for the specified tab.

installDefaultsback to summary
protected void installDefaults()

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.installDefaults.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.installDefaults.

Installs the defaults.

isLastInRunback to summary
private boolean isLastInRun(int tabIndex)
paintback to summary
public void paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paint.

Doc from javax.swing.plaf.ComponentUI.paint.

Paints the specified component appropriately for the look and feel. This method is invoked from the 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.

paintBottomTabBorderback to summary
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.

Parameters
tabIndex:int

a tab index

g:Graphics

an instance of Graphics

x:int

an X coordinate

y:int

an Y coordinate

w:int

a width

h:int

a height

btm:int

bottom

rght:int

right

isSelected:boolean

a selection

paintContentBorderBottomEdgeback to summary
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderBottomEdge.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderBottomEdge.

Paints the content border bottom edge.

paintContentBorderLeftEdgeback to summary
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderLeftEdge.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderLeftEdge.

Paints the content border left edge.

paintContentBorderRightEdgeback to summary
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderRightEdge.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderRightEdge.

Paints the content border right edge.

paintContentBorderTopEdgeback to summary
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderTopEdge.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintContentBorderTopEdge.

Paints the content border top edge.

paintFocusIndicatorback to summary
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintFocusIndicator.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintFocusIndicator.

Paints the focus indicator.

paintHighlightBelowTabback to summary
protected void paintHighlightBelowTab()

Paints highlights below tab.

paintLeftTabBorderback to summary
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.

Parameters
tabIndex:int

a tab index

g:Graphics

an instance of Graphics

x:int

an X coordinate

y:int

an Y coordinate

w:int

a width

h:int

a height

btm:int

bottom

rght:int

right

isSelected:boolean

a selection

paintRightTabBorderback to summary
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.

Parameters
tabIndex:int

a tab index

g:Graphics

an instance of Graphics

x:int

an X coordinate

y:int

an Y coordinate

w:int

a width

h:int

a height

btm:int

bottom

rght:int

right

isSelected:boolean

a selection

paintTabBackgroundback to summary
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBackground.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBackground.

Paints the tab background.

paintTabBorderback to summary
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBorder.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabBorder.

Paints the border around a tab. Note that this function does not paint the background of the tab, that is done elsewhere.

paintTopTabBorderback to summary
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.

Parameters
tabIndex:int

a tab index

g:Graphics

an instance of Graphics

x:int

an X coordinate

y:int

an Y coordinate

w:int

a width

h:int

a height

btm:int

bottom

rght:int

right

isSelected:boolean

a selection

shouldFillGapback to summary
protected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)

Returns true if the gap should be filled.

Parameters
currentRun:int

the current run

tabIndex:int

the tab index

x:int

an X coordinate

y:int

an Y coordinate

Returns:boolean

true if the gap should be filled

shouldPadTabRunback to summary
protected boolean shouldPadTabRun(int tabPlacement, int run)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.shouldPadTabRun.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.shouldPadTabRun.

Returns whether or not the tab run should be padded.

shouldRotateTabRunsback to summary
protected boolean shouldRotateTabRuns(int tabPlacement, int selectedRun)

Returns true if tab runs should be rotated.

Parameters
tabPlacement:int

a tab placement

selectedRun:int

a selected run

Returns:boolean

true if tab runs should be rotated.

updateback to summary
public void update(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.update.

Doc from javax.swing.plaf.ComponentUI.update.

Notifies this UI delegate that it is time to paint the specified component. This method is invoked by 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.

javax.swing.plaf.metal back to summary

public Class MetalTabbedPaneUI.TabbedPaneLayout

extends TabbedPaneLayout
Class Inheritance

This class should be treated as a "protected" inner class. Instantiate it only within subclasses of MetalTabbedPaneUI.

Constructor Summary

AccessConstructor and Description
public
TabbedPaneLayout()

Constructs TabbedPaneLayout.

Method Summary

Modifier and TypeMethod and Description
protected void
normalizeTabRuns(int tabPlacement, int tabCount, int start, int max)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.normalizeTabRuns.

Normalizes the tab runs.

protected void
padSelectedTab(int tabPlacement, int selectedIndex)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.padSelectedTab.

Pads selected tab.

protected void
rotateTabRuns(int tabPlacement, int selectedRun)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.rotateTabRuns.

Rotates the run-index array so that the selected run is run[0].

Inherited from javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout:
addLayoutComponentcalculateLayoutInfocalculateSizecalculateTabRectslayoutContainerminimumLayoutSizepadTabRunpreferredLayoutSizepreferredTabAreaHeightpreferredTabAreaWidthremoveLayoutComponent

Constructor Detail

TabbedPaneLayoutback to summary
public TabbedPaneLayout()

Constructs TabbedPaneLayout.

Method Detail

normalizeTabRunsback to summary
protected void normalizeTabRuns(int tabPlacement, int tabCount, int start, int max)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.normalizeTabRuns.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.normalizeTabRuns.

Normalizes the tab runs.

padSelectedTabback to summary
protected void padSelectedTab(int tabPlacement, int selectedIndex)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.padSelectedTab.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.padSelectedTab.

Pads selected tab.

rotateTabRunsback to summary
protected void rotateTabRuns(int tabPlacement, int selectedRun)

Overrides javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.rotateTabRuns.

Doc from javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout.rotateTabRuns.

Rotates the run-index array so that the selected run is run[0].