|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.TabbedPaneUI javax.swing.plaf.basic.BasicTabbedPaneUI
A Basic L&F implementation of TabbedPaneUI.
Field Summary | |
protected Rectangle |
calcRect
A rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly. |
private ContainerListener |
containerListener
|
protected Insets |
contentBorderInsets
|
private static int |
CROP_SEGMENT
|
private Insets |
currentPadInsets
|
private Insets |
currentTabAreaInsets
|
protected Color |
darkShadow
|
protected KeyStroke |
downKey
Deprecated. As of Java 2 platform v1.3. |
protected Color |
focus
|
protected FocusListener |
focusListener
|
protected Color |
highlight
|
private Vector |
htmlViews
|
protected KeyStroke |
leftKey
Deprecated. As of Java 2 platform v1.3. |
protected Color |
lightHighlight
|
protected int |
maxTabHeight
|
protected int |
maxTabWidth
|
private InputMap |
mnemonicInputMap
InputMap used for mnemonics. |
private Hashtable |
mnemonicToIndexMap
|
protected MouseListener |
mouseListener
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
|
protected Rectangle[] |
rects
|
protected KeyStroke |
rightKey
Deprecated. As of Java 2 platform v1.3. |
protected int |
runCount
|
private Color |
selectedColor
|
protected int |
selectedRun
|
protected Insets |
selectedTabPadInsets
|
protected Color |
shadow
|
protected Insets |
tabAreaInsets
|
protected ChangeListener |
tabChangeListener
|
private int |
tabCount
Number of tabs. |
protected Insets |
tabInsets
|
protected JTabbedPane |
tabPane
|
protected int |
tabRunOverlay
|
protected int[] |
tabRuns
|
private BasicTabbedPaneUI.ScrollableTabSupport |
tabScroller
|
protected int |
textIconGap
|
protected KeyStroke |
upKey
Deprecated. As of Java 2 platform v1.3. |
private Component |
visibleComponent
|
private int[] |
xCropLen
|
private int[] |
yCropLen
|
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 | |
BasicTabbedPaneUI()
|
Method Summary | |
private void |
addMnemonic(int index,
int mnemonic)
Adds the specified mnemonic at the specified index. |
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 metrics)
|
(package private) ActionMap |
createActionMap()
|
protected ChangeListener |
createChangeListener()
|
private Polygon |
createCroppedTabClip(int tabPlacement,
Rectangle tabRect,
int cropline)
|
protected FocusListener |
createFocusListener()
|
private Vector |
createHTMLVector()
|
protected LayoutManager |
createLayoutManager()
Invoked by installUI to create
a layout manager object to manage
the JTabbedPane . |
protected MouseListener |
createMouseListener()
|
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
|
static ComponentUI |
createUI(JComponent c)
Returns an instance of the UI delegate for the specified component. |
private void |
ensureCurrentLayout()
|
protected void |
expandTabRunsArray()
|
(package private) ActionMap |
getActionMap()
|
private int |
getClosestTab(int x,
int y)
Returns the index of the tab closest to the passed in location, note that the returned tab may not contain the location x,y. |
protected Insets |
getContentBorderInsets(int tabPlacement)
|
protected FontMetrics |
getFontMetrics()
|
protected Icon |
getIconForTab(int tabIndex)
|
(package private) InputMap |
getInputMap(int condition)
|
Dimension |
getMaximumSize(JComponent c)
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
getMinimumSize(JComponent c)
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)
|
Dimension |
getPreferredSize(JComponent c)
Returns the specified component's preferred size appropriate for the look and feel. |
protected int |
getPreviousTabIndex(int base)
|
protected int |
getPreviousTabIndexInRun(int tabCount,
int base)
|
protected int |
getPreviousTabRun(int baseRun)
|
protected int |
getRunForTab(int tabCount,
int tabIndex)
|
protected Insets |
getSelectedTabPadInsets(int tabPlacement)
|
protected Insets |
getTabAreaInsets(int tabPlacement)
|
private int |
getTabAtLocation(int x,
int y)
Returns the tab index which intersects the specified point in the coordinate space of the component where the tabs are actually rendered, which could be the JTabbedPane (for WRAP_TAB_LAYOUT) or a ScrollableTabPanel (SCROLL_TAB_LAYOUT). |
protected Rectangle |
getTabBounds(int tabIndex,
Rectangle dest)
Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component. |
Rectangle |
getTabBounds(JTabbedPane pane,
int i)
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 pane)
|
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()
|
private void |
initMnemonics()
Installs the state needed for mnemonics. |
protected void |
installComponents()
Creates and installs any required subcomponents for the JTabbedPane. |
protected void |
installDefaults()
|
protected void |
installKeyboardActions()
|
protected void |
installListeners()
|
void |
installUI(JComponent c)
Configures the specified component appropriate for the look and feel. |
protected int |
lastTabInRun(int tabCount,
int run)
|
protected void |
layoutLabel(int tabPlacement,
FontMetrics metrics,
int tabIndex,
String title,
Icon icon,
Rectangle tabRect,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
|
protected void |
navigateSelectedTab(int direction)
|
void |
paint(Graphics g,
JComponent c)
Paints the specified component appropriate for the look and feel. |
protected void |
paintContentBorder(Graphics g,
int tabPlacement,
int selectedIndex)
|
protected void |
paintContentBorderBottomEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
|
protected void |
paintContentBorderLeftEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
|
protected void |
paintContentBorderRightEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
|
protected void |
paintContentBorderTopEdge(Graphics g,
int tabPlacement,
int selectedIndex,
int x,
int y,
int w,
int h)
|
private void |
paintCroppedTabEdge(Graphics g,
int tabPlacement,
int tabIndex,
boolean isSelected,
int x,
int y)
|
protected void |
paintFocusIndicator(Graphics g,
int tabPlacement,
Rectangle[] rects,
int tabIndex,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
|
protected void |
paintIcon(Graphics g,
int tabPlacement,
int tabIndex,
Icon icon,
Rectangle iconRect,
boolean isSelected)
|
protected void |
paintTab(Graphics g,
int tabPlacement,
Rectangle[] rects,
int tabIndex,
Rectangle iconRect,
Rectangle textRect)
|
protected void |
paintTabArea(Graphics g,
int tabPlacement,
int selectedIndex)
Paints the tabs in the tab area. |
protected void |
paintTabBackground(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
|
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 |
paintText(Graphics g,
int tabPlacement,
Font font,
FontMetrics metrics,
int tabIndex,
String title,
Rectangle textRect,
boolean isSelected)
|
(package private) boolean |
requestFocusForVisibleComponent()
|
private void |
resetMnemonics()
Resets the mnemonics bindings to an empty state. |
protected static void |
rotateInsets(Insets topInsets,
Insets targetInsets,
int targetPlacement)
|
private boolean |
scrollableTabLayoutEnabled()
|
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 |
setVisibleComponent(Component component)
|
protected boolean |
shouldPadTabRun(int tabPlacement,
int run)
|
protected boolean |
shouldRotateTabRuns(int tabPlacement)
|
int |
tabForCoordinate(JTabbedPane pane,
int x,
int y)
Returns the tab index which intersects the specified point in the JTabbedPane's coordinate space. |
private Point |
translatePointToTabPanel(int srcx,
int srcy,
Point dest)
Returns a point which is translated from the specified point in the JTabbedPane's coordinate space to the coordinate space of the ScrollableTabPanel. |
protected void |
uninstallComponents()
Removes any installed subcomponents from the JTabbedPane. |
protected void |
uninstallDefaults()
|
protected void |
uninstallKeyboardActions()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI . |
private void |
updateMnemonics()
Reloads the mnemonics. |
Methods inherited from class javax.swing.plaf.ComponentUI |
contains, getAccessibleChild, getAccessibleChildrenCount, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected JTabbedPane tabPane
protected Color highlight
protected Color lightHighlight
protected Color shadow
protected Color darkShadow
protected Color focus
private Color selectedColor
protected int textIconGap
protected int tabRunOverlay
protected Insets tabInsets
protected Insets selectedTabPadInsets
protected Insets tabAreaInsets
protected Insets contentBorderInsets
protected KeyStroke upKey
protected KeyStroke downKey
protected KeyStroke leftKey
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 java.beans.PropertyChangeListener propertyChangeListener
protected MouseListener mouseListener
protected FocusListener focusListener
private ContainerListener containerListener
private Insets currentPadInsets
private Insets currentTabAreaInsets
private Component visibleComponent
private Vector htmlViews
private Hashtable mnemonicToIndexMap
private InputMap mnemonicInputMap
private BasicTabbedPaneUI.ScrollableTabSupport tabScroller
protected transient Rectangle calcRect
private int tabCount
private int[] xCropLen
private int[] yCropLen
private static final int CROP_SEGMENT
Constructor Detail |
public BasicTabbedPaneUI()
Method Detail |
public static ComponentUI createUI(JComponent c)
ComponentUI
createUI
method that returns an instance of that UI delegate subclass.
If the UI delegate subclass is stateless, it may return an instance
that is shared by multiple components. If the UI delegate is
stateful, then it should return a new instance per component.
The default implementation of this method throws an error, as it
should never be invoked.
public void installUI(JComponent c)
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 installedComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
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 componentsComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected LayoutManager createLayoutManager()
installUI
to create
a layout manager object to manage
the JTabbedPane
.
BasicTabbedPaneUI.TabbedPaneLayout
,
JTabbedPane.getTabLayoutPolicy()
private boolean scrollableTabLayoutEnabled()
protected void installComponents()
protected void uninstallComponents()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void uninstallListeners()
protected MouseListener createMouseListener()
protected FocusListener createFocusListener()
protected ChangeListener createChangeListener()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected void installKeyboardActions()
InputMap getInputMap(int condition)
ActionMap getActionMap()
ActionMap createActionMap()
protected void uninstallKeyboardActions()
private void updateMnemonics()
private void resetMnemonics()
private void addMnemonic(int index, int mnemonic)
private void initMnemonics()
public Dimension getPreferredSize(JComponent c)
ComponentUI
null
is returned, the preferred
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 returns null
.
getPreferredSize
in class ComponentUI
c
- the component whose preferred size is being queried;
this argument is often ignored,
but might be used if the UI object is stateless
and shared by multiple componentsJComponent.getPreferredSize()
,
LayoutManager.preferredLayoutSize(java.awt.Container)
public Dimension getMinimumSize(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 Dimension getMaximumSize(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 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 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.update(java.awt.Graphics, javax.swing.JComponent)
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)
private Polygon createCroppedTabClip(int tabPlacement, Rectangle tabRect, int cropline)
private void paintCroppedTabEdge(Graphics g, int tabPlacement, int tabIndex, boolean isSelected, int x, int y)
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected)
protected void paintText(Graphics g, 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(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
private void ensureCurrentLayout()
public Rectangle getTabBounds(JTabbedPane pane, int i)
getTabBounds
in class TabbedPaneUI
public int getTabRunCount(JTabbedPane pane)
getTabRunCount
in class TabbedPaneUI
public int tabForCoordinate(JTabbedPane pane, int x, int y)
tabForCoordinate
in class TabbedPaneUI
protected 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 placed
private int getTabAtLocation(int x, int y)
private int getClosestTab(int x, int y)
private Point translatePointToTabPanel(int srcx, int srcy, Point dest)
protected Component getVisibleComponent()
protected void setVisibleComponent(Component component)
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 Icon getIconForTab(int tabIndex)
protected View getTextViewForTab(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 Insets getTabInsets(int tabPlacement, int tabIndex)
protected Insets getSelectedTabPadInsets(int tabPlacement)
protected Insets getTabAreaInsets(int tabPlacement)
protected Insets getContentBorderInsets(int tabPlacement)
protected FontMetrics getFontMetrics()
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 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)
protected static void rotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement)
boolean requestFocusForVisibleComponent()
private Vector createHTMLVector()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |