public final class PlasticTabbedPaneUI extends MetalTabbedPaneUI
TabbedPaneUI. It differs from its superclass
MetalTabbedPaneUI in that it paints new tab shapes,
provides two options, and supports ClearLook.
You can enable or disable icons in tabs globally via com.jgoodies.looks.Options.setTabIconsEnabled(boolean).
To disable the content border set
JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.putClientProperty(Option.NO_CONTENT_BORDER_KEY, Boolean.TRUE);To paint embedded tabs use
JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.putClientProperty(Option.EMBEDDED_TABS_KEY, Boolean.TRUE);
There's a special mode that helps you detect content borders in heavily wrapped component hierarchies - such as the NetBeans IDE. In this marked mode the content border is painted as a Magenta line. You can enable this mode by setting the System property markContentBorders to true; in a command line:
java -DmarkContentBorders=true
Thanks to Andrej Golovnin for his feedback and suggestions.
OptionsBasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandlerminTabWidth, selectColor, selectHighlight, tabAreaBackgroundcalcRect, 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, upKeyBOTTOM, 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 |
|---|
PlasticTabbedPaneUI() |
| Modifier and Type | Method and Description |
|---|---|
protected ChangeListener |
createChangeListener() |
protected LayoutManager |
createLayoutManager()
Creates the layout manager used to set the tab's bounds.
|
protected PropertyChangeListener |
createPropertyChangeListener()
Creates and answer a handler that listens to property changes.
|
static ComponentUI |
createUI(JComponent tabPane)
Creates the
PlasticTabbedPaneUI. |
protected Insets |
getContentBorderInsets(int tabPlacement)
Returns the insets (i.e. the width) of the content Border.
|
protected Icon |
getIconForTab(int tabIndex)
Answers the icon for the tab with the specified index.
|
protected Insets |
getSelectedTabPadInsets(int tabPlacement)
Returns the insets for selected tab.
|
protected Insets |
getTabAreaInsets(int tabPlacement)
Returns the amount by which the Tab Area is inset.
|
protected Rectangle |
getTabBounds(int tabIndex,
Rectangle dest) |
protected Insets |
getTabInsets(int tabPlacement,
int tabIndex)
Returns the insets for this tab.
|
protected int |
getTabLabelShiftX(int tabPlacement,
int tabIndex,
boolean isSelected)
Returns the amount by which the label should be shifted horizontally.
|
protected int |
getTabLabelShiftY(int tabPlacement,
int tabIndex,
boolean isSelected)
Returns the amount by which the label should be shifted vertically.
|
protected int |
getTabRunIndent(int tabPlacement,
int run)
Returns the amount by which the run number
run
should be indented. |
protected int |
getTabRunOverlay(int tabPlacement)
Returns the amount (in pixels) by which two runs should overlap.
|
protected void |
installComponents()
Creates and installs any required subcomponents for the JTabbedPane.
|
protected void |
installKeyboardActions() |
void |
installUI(JComponent c)
Installs the UI.
|
protected boolean |
isTabInFirstRun(int tabIndex) |
protected void |
layoutLabel(int tabPlacement,
FontMetrics metrics,
int tabIndex,
String title,
Icon icon,
Rectangle tabRect,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected) |
void |
paint(Graphics g,
JComponent c) |
protected void |
paintContentBorder(Graphics g,
int tabPlacement,
int selectedIndex) |
protected void |
paintFocusIndicator(Graphics g,
int tabPlacement,
Rectangle[] rectangles,
int tabIndex,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
Draws the rectancle around the Tab label which indicates keyboard focus.
|
protected void |
paintTab(Graphics g,
int tabPlacement,
Rectangle[] rects,
int tabIndex,
Rectangle iconRect,
Rectangle textRect) |
protected void |
paintTabArea(Graphics g,
int tabPlacement,
int selectedIndex) |
protected void |
paintTabBackground(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
Fills the background of the given tab to make sure overlap of
tabs is handled correctly.
|
protected void |
paintTabBorder(Graphics g,
int tabPlacement,
int tabIndex,
int x,
int y,
int w,
int h,
boolean isSelected)
Paints the border for one tab.
|
protected boolean |
shouldPadTabRun(int tabPlacement,
int run)
This boolean controls wheather the given run should be padded to
use up as much space as the others (with more tabs in them).
|
protected boolean |
shouldRotateTabRuns(int tabPlacement)
Answers wheather tab runs should be rotated.
|
int |
tabForCoordinate(JTabbedPane pane,
int x,
int y)
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.
|
void |
uninstallUI(JComponent c)
Uninstalls the UI.
|
calculateMaxTabHeight, getBaselineOffset, getColorForGap, installDefaults, paintBottomTabBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintHighlightBelowTab, paintLeftTabBorder, paintRightTabBorder, paintTopTabBorder, shouldFillGap, shouldRotateTabRuns, updateassureRectsCreated, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, calculateTabWidth, createFocusListener, createMouseListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineResizeBehavior, getFocusIndex, getFontMetrics, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getTabBounds, getTabRunCount, getTabRunOffset, getTextViewForTab, getVisibleComponent, installListeners, lastTabInRun, navigateSelectedTab, paintIcon, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, uninstallDefaults, uninstallKeyboardActions, uninstallListenerscontains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSizepublic static ComponentUI createUI(JComponent tabPane)
PlasticTabbedPaneUI.ComponentUI.createUI(JComponent)public void installUI(JComponent c)
installUI in class BasicTabbedPaneUIComponentUI.installUI(JComponent)public void uninstallUI(JComponent c)
uninstallUI in class BasicTabbedPaneUIComponentUI.uninstallUI(JComponent)protected void installComponents()
installComponents in class BasicTabbedPaneUIBasicTabbedPaneUI.installComponents()protected void uninstallComponents()
uninstallComponents in class BasicTabbedPaneUIBasicTabbedPaneUI.uninstallComponents()protected void installKeyboardActions()
installKeyboardActions in class BasicTabbedPaneUIprotected PropertyChangeListener createPropertyChangeListener()
createPropertyChangeListener in class BasicTabbedPaneUIprotected ChangeListener createChangeListener()
createChangeListener in class BasicTabbedPaneUIpublic void paint(Graphics g, JComponent c)
paint in class MetalTabbedPaneUIprotected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
paintTab in class BasicTabbedPaneUIpublic int tabForCoordinate(JTabbedPane pane, int x, int y)
tabForCoordinate in class BasicTabbedPaneUIprotected Rectangle getTabBounds(int tabIndex, Rectangle dest)
getTabBounds in class BasicTabbedPaneUIprotected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
paintTabArea in class BasicTabbedPaneUIprotected void layoutLabel(int tabPlacement,
FontMetrics metrics,
int tabIndex,
String title,
Icon icon,
Rectangle tabRect,
Rectangle iconRect,
Rectangle textRect,
boolean isSelected)
layoutLabel in class BasicTabbedPaneUIprotected Icon getIconForTab(int tabIndex)
null if and only if we have a title.getIconForTab in class BasicTabbedPaneUIprotected LayoutManager createLayoutManager()
createLayoutManager in class MetalTabbedPaneUIprotected boolean isTabInFirstRun(int tabIndex)
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
paintContentBorder in class BasicTabbedPaneUIprotected Insets getContentBorderInsets(int tabPlacement)
getContentBorderInsets in class BasicTabbedPaneUIprotected Insets getTabAreaInsets(int tabPlacement)
getTabAreaInsets in class BasicTabbedPaneUIprotected int getTabLabelShiftX(int tabPlacement,
int tabIndex,
boolean isSelected)
getTabLabelShiftX in class MetalTabbedPaneUIprotected int getTabLabelShiftY(int tabPlacement,
int tabIndex,
boolean isSelected)
getTabLabelShiftY in class MetalTabbedPaneUIprotected int getTabRunOverlay(int tabPlacement)
getTabRunOverlay in class MetalTabbedPaneUIprotected boolean shouldPadTabRun(int tabPlacement,
int run)
shouldPadTabRun in class MetalTabbedPaneUIprotected int getTabRunIndent(int tabPlacement,
int run)
run
should be indented. Add six pixels for every run to make
diagonal lines align.getTabRunIndent in class BasicTabbedPaneUIprotected Insets getTabInsets(int tabPlacement, int tabIndex)
getTabInsets in class BasicTabbedPaneUIprotected Insets getSelectedTabPadInsets(int tabPlacement)
getSelectedTabPadInsets in class BasicTabbedPaneUIprotected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rectangles, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
paintFocusIndicator in class MetalTabbedPaneUIprotected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
paintTabBackground in class MetalTabbedPaneUIprotected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
paintTabBorder in class MetalTabbedPaneUIprotected boolean shouldRotateTabRuns(int tabPlacement)
shouldRotateTabRuns in class BasicTabbedPaneUICopyright © 2001-2014 JGoodies Software GmbH. All Rights Reserved.