|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.TabbedPaneUI
javax.swing.plaf.basic.BasicTabbedPaneUI
javax.swing.plaf.metal.MetalTabbedPaneUI
public class MetalTabbedPaneUI
A UI delegate for the JTabbedPane
component.
Nested Class Summary | |
---|---|
class |
MetalTabbedPaneUI.TabbedPaneLayout
A LayoutManager responsible for placing all the tabs and the
visible component inside the JTabbedPane . |
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTabbedPaneUI |
---|
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabSelectionHandler |
Field Summary | |
---|---|
protected int |
minTabWidth
The minimum tab width. |
protected Color |
selectColor
The color for the selected tab. |
protected Color |
selectHighlight
The color for a highlighted selected tab. |
protected Color |
tabAreaBackground
The background color used for the tab area. |
Fields inherited from class javax.swing.plaf.basic.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 |
Fields 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 | |
---|---|
MetalTabbedPaneUI()
Constructs a new instance of MetalTabbedPaneUI. |
Method Summary | |
---|---|
protected int |
calculateMaxTabHeight(int tabPlacement)
This method returns the max tab height. |
protected LayoutManager |
createLayoutManager()
Creates and returns an instance of MetalTabbedPaneUI.TabbedPaneLayout . |
static ComponentUI |
createUI(JComponent component)
Returns an instance of MetalTabbedPaneUI. |
protected Color |
getColorForGap(int currentRun,
int x,
int y)
Returns the color for the gap. |
protected int |
getTabLabelShiftX(int tabPlacement,
int index,
boolean isSelected)
This method returns how much the label for the tab should shift in the X direction. |
protected int |
getTabLabelShiftY(int tabPlacement,
int index,
boolean isSelected)
This method returns how much the label for the tab should shift in the Y direction. |
protected int |
getTabRunOverlay(int tabPlacement)
Returns the amount of overlay among the tabs. |
protected void |
installDefaults()
Installs the defaults for this UI. |
protected void |
paintBottomTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the border for a tab assuming that the tab position is at the bottom ( SwingConstants.BOTTOM ). |
protected void |
paintContentBorderBottomEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the lower edge of the content border. |
protected void |
paintContentBorderLeftEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the left edge of the content border. |
protected void |
paintContentBorderRightEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the right edge of the content border. |
protected void |
paintContentBorderTopEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
Paints the upper edge of the content border. |
protected void |
paintFocusIndicator(Graphics g,
int tabPlacement,
Rectangle[] rects,
int tabIndex,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
This method paints the focus rectangle around the selected tab. |
protected void |
paintHighlightBelowTab()
Paints the highlight below the tab, if there is one. |
protected void |
paintLeftTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the border for a tab assuming that the tab position is at the left ( SwingConstants.LEFT ). |
protected void |
paintRightTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the border for a tab assuming that the tab position is at the right ( SwingConstants.RIGHT ). |
protected void |
paintTabBackground(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
Paints the background for a tab. |
protected void |
paintTabBorder(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
Paints the border for a single tab. |
protected void |
paintTopTabBorder(int tabIndex,
Graphics g,
int x,
int y,
int w,
int h,
int btm,
int rght,
boolean isSelected)
Paints the border for a tab assuming that the tab position is at the top ( SwingConstants.TOP ). |
protected boolean |
shouldFillGap(int currentRun,
int tabIndex,
int x,
int y)
Returns true if the gap should be filled in. |
protected boolean |
shouldPadTabRun(int tabPlacement,
int run)
Returns true if the tabs in the specified run should be
padded to make the run fill the width/height of the JTabbedPane . |
protected boolean |
shouldRotateTabRuns(int tabPlacement,
int selectedRun)
Returns true if we should rotate the tab runs. |
Methods inherited from class javax.swing.plaf.ComponentUI |
---|
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int minTabWidth
protected Color selectColor
protected Color selectHighlight
protected Color tabAreaBackground
Constructor Detail |
---|
public MetalTabbedPaneUI()
Method Detail |
---|
public static ComponentUI createUI(JComponent component)
component
- the component for which we return an UI instance
protected LayoutManager createLayoutManager()
MetalTabbedPaneUI.TabbedPaneLayout
.
createLayoutManager
in class BasicTabbedPaneUI
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
paintTabBorder
in class BasicTabbedPaneUI
g
- the graphics device.tabPlacement
- the tab placement (SwingConstants.TOP
, SwingConstants.LEFT
,
SwingConstants.BOTTOM
or SwingConstants.RIGHT
).tabIndex
- the index of the tab to draw the border for.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.isSelected
- indicates whether or not the tab is selected.protected void paintTopTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
SwingConstants.TOP
).
tabIndex
- the tab index.g
- the graphics device.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.btm
- the y coordinate of the bottom borderrght
- the x coordinate of the right borderisSelected
- indicates whether the tab is selected.protected void paintLeftTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
SwingConstants.LEFT
).
tabIndex
- the tab index.g
- the graphics device.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.btm
- ???rght
- ???isSelected
- indicates whether the tab is selected.protected void paintRightTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
SwingConstants.RIGHT
).
tabIndex
- the tab index.g
- the graphics device.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.btm
- ???rght
- ???isSelected
- indicates whether the tab is selected.protected void paintBottomTabBorder(int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, boolean isSelected)
SwingConstants.BOTTOM
).
tabIndex
- the tab index.g
- the graphics device.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.btm
- ???rght
- ???isSelected
- indicates whether the tab is selected.protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
paintTabBackground
in class BasicTabbedPaneUI
g
- the graphics device.tabPlacement
- the tab placement (SwingConstants.TOP
, SwingConstants.LEFT
,
SwingConstants.BOTTOM
or SwingConstants.RIGHT
).tabIndex
- the index of the tab to draw the border for.x
- the x-coordinate for the tab's bounding rectangle.y
- the y-coordinate for the tab's bounding rectangle.w
- the width for the tab's bounding rectangle.h
- the height for the tab's bounding rectangle.isSelected
- indicates whether or not the tab is selected.protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
paintFocusIndicator
in class BasicTabbedPaneUI
g
- The Graphics object to paint with.tabPlacement
- The JTabbedPane's tab placement.rects
- The array of rectangles keeping track of size and position.tabIndex
- The tab index.iconRect
- The icon bounds.textRect
- The text bounds.isSelected
- Whether this tab is selected.protected boolean shouldPadTabRun(int tabPlacement, int run)
true
if the tabs in the specified run should be
padded to make the run fill the width/height of the JTabbedPane
.
shouldPadTabRun
in class BasicTabbedPaneUI
tabPlacement
- the tab placement for the JTabbedPane
(one of
SwingConstants.TOP
, SwingConstants.BOTTOM
, SwingConstants.LEFT
and SwingConstants.RIGHT
).run
- the run index.
protected void installDefaults()
installDefaults
in class BasicTabbedPaneUI
protected Color getColorForGap(int currentRun, int x, int y)
currentRun
- - The current run to return the color forx
- - The x position of the current runy
- - The y position of the current run
protected boolean shouldFillGap(int currentRun, int tabIndex, int x, int y)
currentRun
- - The current runtabIndex
- - The current tabx
- - The x position of the taby
- - The y position of the tab
protected void paintHighlightBelowTab()
protected boolean shouldRotateTabRuns(int tabPlacement, int selectedRun)
tabPlacement
- - The current tab placement.selectedRun
- - The selected run.
protected int calculateMaxTabHeight(int tabPlacement)
BasicTabbedPaneUI
calculateMaxTabHeight
in class BasicTabbedPaneUI
tabPlacement
- The JTabbedPane's tab placement.
protected int getTabRunOverlay(int tabPlacement)
getTabRunOverlay
in class BasicTabbedPaneUI
tabPlacement
- the placement
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
paintContentBorderTopEdge
in class BasicTabbedPaneUI
g
- the graphics to use for paintingtabPlacement
- the tab placementselectedIndex
- the index of the selected tabx
- the upper left coordinate of the content areay
- the upper left coordinate of the content areaw
- the width of the content areah
- the height of the content areaprotected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
paintContentBorderBottomEdge
in class BasicTabbedPaneUI
g
- the graphics to use for paintingtabPlacement
- the tab placementselectedIndex
- the index of the selected tabx
- the upper left coordinate of the content areay
- the upper left coordinate of the content areaw
- the width of the content areah
- the height of the content areaprotected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
paintContentBorderLeftEdge
in class BasicTabbedPaneUI
g
- the graphics to use for paintingtabPlacement
- the tab placementselectedIndex
- the index of the selected tabx
- the upper left coordinate of the content areay
- the upper left coordinate of the content areaw
- the width of the content areah
- the height of the content areaprotected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
paintContentBorderRightEdge
in class BasicTabbedPaneUI
g
- the graphics to use for paintingtabPlacement
- the tab placementselectedIndex
- the index of the selected tabx
- the upper left coordinate of the content areay
- the upper left coordinate of the content areaw
- the width of the content areah
- the height of the content areaprotected int getTabLabelShiftX(int tabPlacement, int index, boolean isSelected)
BasicTabbedPaneUI
getTabLabelShiftX
in class BasicTabbedPaneUI
tabPlacement
- The JTabbedPane's tab placement.index
- The tab index being painted.isSelected
- Whether this tab is selected.
protected int getTabLabelShiftY(int tabPlacement, int index, boolean isSelected)
BasicTabbedPaneUI
getTabLabelShiftY
in class BasicTabbedPaneUI
tabPlacement
- The JTabbedPane's tab placement.index
- The tab index being painted.isSelected
- Whether this tab is selected.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |