public class BasicTabbedPaneUI extends TabbedPaneUIimplements SwingConstants
| Modifier and Type | Class and Description |
|---|---|
class |
BasicTabbedPaneUI
This class should be treated as a "protected" inner class.
|
class |
BasicTabbedPaneUI
This class should be treated as a "protected" inner class.
|
class |
BasicTabbedPaneUI
This class should be treated as a "protected" inner class.
|
class |
BasicTabbedPaneUI
This class should be treated as a "protected" inner class.
|
class |
BasicTabbedPaneUI
This class should be treated as a "protected" inner class.
|
| Modifier and Type | Field and 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
|
protected Color |
darkShadow
|
protected KeyStroke |
downKey
Deprecated.
As of Java 2 platform v1.3.
|
protected Color |
focus
|
protected FocusListener |
focusListener
|
protected Color |
highlight
|
protected KeyStroke |
leftKey
Deprecated.
As of Java 2 platform v1.3.
|
protected Color |
lightHighlight
|
protected int |
maxTabHeight
|
protected int |
maxTabWidth
|
protected MouseListener |
mouseListener
|
protected PropertyChangeListener |
propertyChangeListener
|
protected Rectangle |
rects
|
protected KeyStroke |
rightKey
Deprecated.
As of Java 2 platform v1.3.
|
protected int |
runCount
|
protected int |
selectedRun
|
protected Insets |
selectedTabPadInsets
|
protected Color |
shadow
|
protected Insets |
tabAreaInsets
|
protected ChangeListener |
tabChangeListener
|
protected Insets |
tabInsets
|
protected JTabbedPane |
tabPane
|
protected int |
tabRunOverlay
|
protected int[] |
tabRuns
|
protected int |
textIconGap
|
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 and Description |
|---|
BasicTabbedPaneUI()
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
assureRectsCreated(int tabCount)
|
protected int |
calculateMaxTabHeight(int tabPlacement)
|
protected int |
calculateMaxTabWidth(int tabPlacement)
|
protected int |
calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight)
|
protected int |
calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth)
|
protected int |
calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
|
protected int |
calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics
|
protected ChangeListener |
createChangeListener()
|
protected FocusListener |
createFocusListener()
|
protected LayoutManager |
createLayoutManager()
Invoked by
installUI to create a layout manager object to manage the
JTabbedPane.
|
protected MouseListener |
createMouseListener()
|
protected PropertyChangeListener |
createPropertyChangeListener()
|
protected JButton |
createScrollButton(int direction)
Creates and returns a JButton that will provide the user with a way to scroll the tabs in a particular direction.
|
static ComponentUI |
createUI(JComponent
|
protected void |
expandTabRunsArray()
|
protected int |
getBaseline(int tab)
Returns the baseline for the specified tab.
|
int |
getBaseline(JComponent
Returns the baseline.
|
protected int |
getBaselineOffset()
Returns the amount the baseline is offset by.
|
Component |
getBaselineResizeBehavior(JComponent
Returns an enum indicating how the baseline of the component changes as the size changes.
|
protected Insets |
getContentBorderInsets(int tabPlacement)
|
protected int |
getFocusIndex()
Returns the index of the tab that has focus.
|
protected FontMetrics |
getFontMetrics()
|
protected Icon |
getIconForTab(int tabIndex)
|
Dimension |
getMaximumSize(JComponent
Returns the specified component's maximum size appropriate for the look and feel.
|
Dimension |
getMinimumSize(JComponent
Returns the specified component's minimum size appropriate for the look and feel.
|
protected int |
getNextTabIndex(int base)
|
protected int |
getNextTabIndexInRun(int tabCount, int base)
|
protected int |
getNextTabRun(int baseRun)
|
protected int |
getPreviousTabIndex(int base)
|
protected int |
getPreviousTabIndexInRun(int tabCount, int base)
|
protected int |
getPreviousTabRun(int baseRun)
|
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(int tabCount, int tabIndex)
|
protected Insets |
getSelectedTabPadInsets(int tabPlacement)
|
protected Insets |
getTabAreaInsets(int tabPlacement)
|
protected Rectangle |
getTabBounds(int tabIndex, Rectangle
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.
|
Rectangle |
getTabBounds(JTabbedPane
Returns the bounds of the specified tab index.
|
protected Insets |
getTabInsets(int tabPlacement, int tabIndex)
|
protected int |
getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
|
protected int |
getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
|
int |
getTabRunCount(JTabbedPane
|
protected int |
getTabRunIndent(int tabPlacement, int run)
|
protected int |
getTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward)
|
protected int |
getTabRunOverlay(int tabPlacement)
|
protected View |
getTextViewForTab(int tabIndex)
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()
|
protected void |
installComponents()
Creates and installs any required subcomponents for the JTabbedPane.
|
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent
Configures the specified component appropriately for the look and feel.
|
protected int |
lastTabInRun(int tabCount, int run)
|
protected void |
layoutLabel(int tabPlacement, FontMetrics
|
protected void |
navigateSelectedTab(int direction)
|
void |
paint(Graphics
Paints the specified component appropriately for the look and feel.
|
protected void |
paintContentBorder(Graphics
|
protected void |
paintContentBorderBottomEdge(Graphics
|
protected void |
paintContentBorderLeftEdge(Graphics
|
protected void |
paintContentBorderRightEdge(Graphics
|
protected void |
paintContentBorderTopEdge(Graphics
|
protected void |
paintFocusIndicator(Graphics
|
protected void |
paintIcon(Graphics
|
protected void |
paintTab(Graphics
|
protected void |
paintTabArea(Graphics
Paints the tabs in the tab area.
|
protected void |
paintTabBackground(Graphics
|
protected void |
paintTabBorder(Graphics
this function draws the border around each tab note that this function does now draw the background of the tab.
|
protected void |
paintText(Graphics
|
protected static void |
rotateInsets(Insets
|
protected void |
selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset)
|
protected void |
selectNextTab(int current)
|
protected void |
selectNextTabInRun(int current)
|
protected void |
selectPreviousTab(int current)
|
protected void |
selectPreviousTabInRun(int current)
|
protected void |
setRolloverTab(int index)
Sets the tab the mouse is currently over to
index.
|
protected void |
setVisibleComponent(Component
|
protected boolean |
shouldPadTabRun(int tabPlacement, int run)
|
protected boolean |
shouldRotateTabRuns(int tabPlacement)
|
int |
tabForCoordinate(JTabbedPane
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()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent
Reverses configuration which was done on the specified component during
installUI.
|
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, updateprotected JTabbedPanetabPane
protected Colorhighlight
protected ColorlightHighlight
protected Colorshadow
protected ColordarkShadow
protected Colorfocus
protected int textIconGap
protected int tabRunOverlay
protected InsetstabInsets
protected InsetsselectedTabPadInsets
protected InsetstabAreaInsets
protected InsetscontentBorderInsets
@Deprecated protected KeyStrokeupKey
@Deprecated protected KeyStrokedownKey
@Deprecated protected KeyStrokeleftKey
@Deprecated protected KeyStrokerightKey
protected int[] tabRuns
protected int runCount
protected int selectedRun
protected Rectangle[] rects
protected int maxTabHeight
protected int maxTabWidth
protected ChangeListenertabChangeListener
protected PropertyChangeListenerpropertyChangeListener
protected MouseListenermouseListener
protected FocusListenerfocusListener
protected transient RectanglecalcRect
public static ComponentUIcreateUI(JComponent c)
public void installUI(JComponentc)
ComponentUI
ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:
LayoutManager on the component if necessary. PropertyChangeListener on the component in order to detect and respond to component property changes appropriately. installUI in class
ComponentUI
c - the component where this UI delegate is being installed
ComponentUI.uninstallUI(javax.swing.JComponent) ,
JComponent.setUI(javax.swing.plaf.ComponentUI) ,
JComponent.updateUI()
public void uninstallUI(JComponentc)
ComponentUI
installUI. This method is invoked when this
UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in
installUI, being careful to leave the
JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:
uninstallUI in class
ComponentUI
c - the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
ComponentUI.installUI(javax.swing.JComponent) ,
JComponent.updateUI()
protected LayoutManagercreateLayoutManager()
installUI to create a layout manager object to manage the
JTabbedPane.
BasicTabbedPaneUI.TabbedPaneLayout,
JTabbedPane.getTabLayoutPolicy()
protected void installComponents()
protected JButtoncreateScrollButton(int direction)
direction - One of the SwingConstants constants: SOUTH, NORTH, EAST or WEST
IllegalArgumentException - if direction is not one of NORTH, SOUTH, EAST or WEST
JTabbedPane.setTabPlacement(int) ,
SwingConstants
protected void uninstallComponents()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void uninstallListeners()
protected MouseListenercreateMouseListener()
protected FocusListenercreateFocusListener()
protected ChangeListenercreateChangeListener()
protected PropertyChangeListenercreatePropertyChangeListener()
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 tab
public DimensiongetMinimumSize(JComponent c)
ComponentUI
null is returned, the minimum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes
getPreferredSize and returns that value.
getMinimumSize in class
ComponentUI
c - the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Dimension object or
null
JComponent.getMinimumSize() ,
LayoutManager.minimumLayoutSize(java.awt.Container) ,
ComponentUI.getPreferredSize(javax.swing.JComponent)
public DimensiongetMaximumSize(JComponent c)
ComponentUI
null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes
getPreferredSize and returns that value.
getMaximumSize in class
ComponentUI
c - the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
Dimension object or
null
JComponent.getMaximumSize() ,
LayoutManager2.maximumLayoutSize(java.awt.Container)
public int getBaseline(JComponentc, int width, int height)
getBaseline in class
ComponentUI
c -
JComponent baseline is being requested for
width - the width to get the baseline for
height - the height to get the baseline for
NullPointerException - if
c is
null
IllegalArgumentException - if width or height is < 0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior in class
ComponentUI
c -
JComponent to return baseline resize behavior for
NullPointerException - if
c is
null
JComponent.getBaseline(int, int)
protected int getBaseline(int tab)
tab - index of tab to get baseline for
IndexOutOfBoundsException - if index is out of range (index < 0 || index >= tab count)
protected int getBaselineOffset()
getTabLabelShiftY.
public void paint(Graphicsg, 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
ComponentUI
g - the
Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintTabArea(Graphicsg, 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 rendering
tabPlacement - the placement for the tabs within the JTabbedPane
selectedIndex - the tab index of the selected component
protected void paintTab(Graphicsg, int tabPlacement, Rectangle [] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
protected void layoutLabel(int tabPlacement,
FontMetrics metrics,
int tabIndex,
String title,
Icon icon,
Rectangle tabRect,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected) protected void paintIcon(Graphicsg, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected)
protected void paintText(Graphicsg, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
protected int getTabLabelShiftX(int tabPlacement,
int tabIndex,
boolean isSelected)protected int getTabLabelShiftY(int tabPlacement,
int tabIndex,
boolean isSelected)protected void paintFocusIndicator(Graphicsg, int tabPlacement, Rectangle [] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected void paintTabBorder(Graphicsg, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintTabBackground(Graphicsg, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintContentBorder(Graphicsg, int tabPlacement, int selectedIndex)
protected void paintContentBorderTopEdge(Graphicsg, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderLeftEdge(Graphicsg, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderBottomEdge(Graphicsg, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderRightEdge(Graphicsg, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
public RectanglegetTabBounds(JTabbedPane pane, int i)
public int getTabRunCount(JTabbedPanepane)
public int tabForCoordinate(JTabbedPanepane, int x, int y)
protected RectanglegetTabBounds(int tabIndex, Rectangle dest)
Rectangle instance. The handling of invalid parameters is unspecified.
tabIndex - the index of the tab
dest - the rectangle where the result should be placed
protected ComponentgetVisibleComponent()
protected void setVisibleComponent(Componentcomponent)
protected void assureRectsCreated(int tabCount)
protected void expandTabRunsArray()
protected int getRunForTab(int tabCount,
int tabIndex)protected int lastTabInRun(int tabCount,
int run)protected int getTabRunOverlay(int tabPlacement)
protected int getTabRunIndent(int tabPlacement,
int run)protected boolean shouldPadTabRun(int tabPlacement,
int run)protected boolean shouldRotateTabRuns(int tabPlacement)
protected IcongetIconForTab(int tabIndex)
protected ViewgetTextViewForTab(int tabIndex)
tabIndex - the index of the tab
protected int calculateTabHeight(int tabPlacement,
int tabIndex,
int fontHeight)protected int calculateMaxTabHeight(int tabPlacement)
protected int calculateTabWidth(int tabPlacement,
int tabIndex,
FontMetrics metrics) protected int calculateMaxTabWidth(int tabPlacement)
protected int calculateTabAreaHeight(int tabPlacement,
int horizRunCount,
int maxTabHeight)protected int calculateTabAreaWidth(int tabPlacement,
int vertRunCount,
int maxTabWidth)protected InsetsgetTabInsets(int tabPlacement, int tabIndex)
protected InsetsgetSelectedTabPadInsets(int tabPlacement)
protected InsetsgetTabAreaInsets(int tabPlacement)
protected InsetsgetContentBorderInsets(int tabPlacement)
protected FontMetricsgetFontMetrics()
protected void navigateSelectedTab(int direction)
protected void selectNextTabInRun(int current)
protected void selectPreviousTabInRun(int current)
protected void selectNextTab(int current)
protected void selectPreviousTab(int current)
protected void selectAdjacentRunTab(int tabPlacement,
int tabIndex,
int offset)protected int getFocusIndex()
protected int getTabRunOffset(int tabPlacement,
int tabCount,
int tabIndex,
boolean forward)protected int getPreviousTabIndex(int base)
protected int getNextTabIndex(int base)
protected int getNextTabIndexInRun(int tabCount,
int base)protected int getPreviousTabIndexInRun(int tabCount,
int base)protected int getPreviousTabRun(int baseRun)
protected int getNextTabRun(int baseRun)