Class SynthTabbedPaneUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TabbedPaneUI
javax.swing.plaf.basic.BasicTabbedPaneUI
javax.swing.plaf.synth.SynthTabbedPaneUI
- All Implemented Interfaces:
PropertyChangeListener, EventListener, SynthConstants, SynthUI, SwingConstants
Provides the Synth L&F UI delegate for
JTabbedPane.
Looks up the selectedTabPadInsets property from the Style,
which represents additional insets for the selected tab.
- Since:
- 1.7
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabbedPaneLayout, BasicTabbedPaneUI.TabSelectionHandlerModifier and TypeClassDescriptionclassThis class should be treated as a "protected" inner class.classThis class should be treated as a "protected" inner class.classThis class should be treated as a "protected" inner class.classThis class should be treated as a "protected" inner class.classThis class should be treated as a "protected" inner class. -
Field Summary
Fields inherited from class 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, upKeyModifier and TypeFieldDescriptionprotected RectangleA rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly.protected InsetsContent border insetsprotected ColorDark shadow colorprotected KeyStrokeDeprecated.As of Java 2 platform v1.3.protected ColorFocus colorprotected FocusListenerFocus change listenerprotected ColorHighlight colorprotected KeyStrokeDeprecated.As of Java 2 platform v1.3.protected ColorLight highlight colorprotected intMaximum tab heightprotected intMaximum tab widthprotected MouseListenerMouse change listenerprotected PropertyChangeListenerProperty change listenerprotected Rectangle[]Tab rectsprotected KeyStrokeDeprecated.As of Java 2 platform v1.3.protected intRun countprotected intSelected runprotected InsetsSelected tab insetsprotected ColorShadow colorprotected InsetsTab area insetsprotected ChangeListenerTab change listenerprotected InsetsTab insetsprotected JTabbedPaneThe tab paneprotected intTab run overlayprotected int[]Tab runsprotected intText icon gapprotected KeyStrokeDeprecated.As of Java 2 platform v1.3.Fields inherited from interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTModifier and TypeFieldDescriptionstatic final intBox-orientation constant used to specify the bottom of a box.static final intThe central position in an area.static final intCompass-direction east (right).static final intHorizontal orientation.static final intIdentifies the leading edge of text for use with left-to-right and right-to-left languages.static final intBox-orientation constant used to specify the left side of a box.static final intIdentifies the next direction in a sequence.static final intCompass-direction North (up).static final intCompass-direction north-east (upper right).static final intCompass-direction north west (upper left).static final intIdentifies the previous direction in a sequence.static final intBox-orientation constant used to specify the right side of a box.static final intCompass-direction south (down).static final intCompass-direction south-east (lower right).static final intCompass-direction south-west (lower left).static final intBox-orientation constant used to specify the top of a box.static final intIdentifies the trailing edge of text for use with left-to-right and right-to-left languages.static final intVertical orientation.static final intCompass-direction west (left).Fields inherited from interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTEDModifier and TypeFieldDescriptionstatic final intIndicates the region is the default.static final intPrimary state indicating the region is not enabled.static final intPrimary state indicating the component is enabled.static final intIndicates the region has focus.static final intPrimary state indicating the mouse is over the region.static final intPrimary state indicating the region is in a pressed state.static final intIndicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intcalculateMaxTabHeight(int tabPlacement) Calculates the maximum tab height.protected intcalculateMaxTabWidth(int tabPlacement) Calculates the maximum tab width.protected intcalculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) Calculates the tab width.protected LayoutManagerInvoked byinstallUIto create a layout manager object to manage theJTabbedPane.protected MouseListenerCreates a mouse listener.protected JButtoncreateScrollButton(int direction) Creates and returns a JButton that will provide the user with a way to scroll the tabs in a particular direction.static ComponentUICreates a new UI object for the given component.protected intgetBaseline(int tab) Returns the baseline for the specified tab.Returns the Context for the specified component.protected FontMetricsReturns the font metrics.protected InsetsgetTabInsets(int tabPlacement, int tabIndex) Returns the tab insets.protected intgetTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift x.protected intgetTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift y.protected voidInstalls the defaults.protected voidInstalls the listeners.voidpaint(Graphics g, JComponent c) Paints the specified component according to the Look and Feel.protected voidpaint(SynthContext context, Graphics g) Paints the specified component.voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.protected voidpaintTabArea(Graphics g, int tabPlacement, int selectedIndex) Paints the tabs in the tab area.voidThis method gets called when a bound property is changed.protected voidsetRolloverTab(int index) Sets the tab the mouse is currently over toindex.protected voidUninstalls the defaults.protected voidUninstalls the listeners.voidupdate(Graphics g, JComponent c) Notifies this UI delegate to repaint the specified component.Methods inherited from class BasicTabbedPaneUI
assureRectsCreated, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, createChangeListener, createFocusListener, createPropertyChangeListener, expandTabRunsArray, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getContentBorderInsets, getFocusIndex, getIconForTab, getMaximumSize, getMinimumSize, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabRunCount, getTabRunIndent, getTabRunOffset, getTabRunOverlay, getTextViewForTab, getVisibleComponent, installComponents, installKeyboardActions, installUI, lastTabInRun, layoutLabel, navigateSelectedTab, paintContentBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintFocusIndicator, paintIcon, paintTab, paintTabBackground, paintTabBorder, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setVisibleComponent, shouldPadTabRun, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallKeyboardActions, uninstallUIModifier and TypeMethodDescriptionprotected voidassureRectsCreated(int tabCount) Assures the tab rectangles are created.protected intcalculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) Calculates the tab area height.protected intcalculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth) Calculates the tab area width.protected intcalculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) Calculates the tab height.protected ChangeListenerCreates a change listener.protected FocusListenerCreates a focus listener.protected PropertyChangeListenerCreates a property change listener.protected voidExpands the tab runs array.intgetBaseline(JComponent c, int width, int height) Returns the baseline.protected intReturns the amount the baseline is offset by.Returns an enum indicating how the baseline of the component changes as the size changes.protected InsetsgetContentBorderInsets(int tabPlacement) Returns the content border insets.protected intReturns the index of the tab that has focus.protected IcongetIconForTab(int tabIndex) Returns the icon for a tab.Returns the specified component's maximum size appropriate for the look and feel.Returns the specified component's minimum size appropriate for the look and feel.protected intgetNextTabIndex(int base) Returns the next tab index.protected intgetNextTabIndexInRun(int tabCount, int base) Returns the next tab index in the run.protected intgetNextTabRun(int baseRun) Returns the next tab run.protected intgetPreviousTabIndex(int base) Returns the previous tab index.protected intgetPreviousTabIndexInRun(int tabCount, int base) Returns the previous tab index in the run.protected intgetPreviousTabRun(int baseRun) Returns the previous tab run.protected intReturns the tab the mouse is currently over, or-1if the mouse is no longer over any tab.protected intgetRunForTab(int tabCount, int tabIndex) Returns the run for a tab.protected InsetsgetSelectedTabPadInsets(int tabPlacement) Returns the selected tab pad insets.protected InsetsgetTabAreaInsets(int tabPlacement) Returns the tab area insets.protected RectanglegetTabBounds(int tabIndex, Rectangle dest) Returns the bounds of the specified tab in the coordinate space of the JTabbedPane component.getTabBounds(JTabbedPane pane, int i) Returns the bounds of the specified tab index.intgetTabRunCount(JTabbedPane pane) Returns the tab run count.protected intgetTabRunIndent(int tabPlacement, int run) Returns the tab run indent.protected intgetTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward) Returns the tab run offset.protected intgetTabRunOverlay(int tabPlacement) Returns the tab run overlay.protected ViewgetTextViewForTab(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 ComponentReturns the visible component.protected voidCreates and installs any required subcomponents for the JTabbedPane.protected voidInstalls the keyboard actions.voidConfigures the specified component appropriately for the look and feel.protected intlastTabInRun(int tabCount, int run) Returns the last tab in a run.protected voidlayoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) Lays out a label.protected voidnavigateSelectedTab(int direction) Navigates the selected tab.protected voidpaintContentBorder(Graphics g, int tabPlacement, int selectedIndex) Paints the content border.protected voidpaintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border bottom edge.protected voidpaintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border left edge.protected voidpaintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border right edge.protected voidpaintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border top edge.protected voidpaintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) Paints the focus indicator.protected voidpaintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) Paints an icon.protected voidpaintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) Paints a tab.protected voidpaintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) Paints the tab background.protected voidpaintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) Paints the border around a tab.protected voidpaintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) Paints text.protected static voidrotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement) Rotates the insets.protected voidselectAdjacentRunTab(int tabPlacement, int tabIndex, int offset) Selects an adjacent run of tabs.protected voidselectNextTab(int current) Selects the next tab.protected voidselectNextTabInRun(int current) Selects the next tab in the run.protected voidselectPreviousTab(int current) Selects the previous tab.protected voidselectPreviousTabInRun(int current) Selects the previous tab in the run.protected voidsetVisibleComponent(Component component) Sets the visible component.protected booleanshouldPadTabRun(int tabPlacement, int run) Returns whether or not the tab run should be padded.protected booleanshouldRotateTabRuns(int tabPlacement) Returns whether or not the tab run should be rotated.inttabForCoordinate(JTabbedPane pane, int x, int y) Returns the tab index which intersects the specified point in the JTabbedPane's coordinate space.protected voidRemoves any installed subcomponents from the JTabbedPane.protected voidUninstalls the keyboard actions.voidReverses configuration which was done on the specified component duringinstallUI.Methods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSizeModifier and TypeMethodDescriptionbooleancontains(JComponent c, int x, int y) Returnstrueif the specified x,y location is contained within the look and feel's defined shape of the specified component.getAccessibleChild(JComponent c, int i) Returns theithAccessiblechild of the object.intReturns the number of accessible children in the object.Returns the specified component's preferred size appropriate for the look and feel.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
SynthTabbedPaneUI
public SynthTabbedPaneUI()Constructs aSynthTabbedPaneUI.
-
-
Method Details
-
createUI
Creates a new UI object for the given component.- Parameters:
c- component to create UI object for- Returns:
- the UI object
-
installDefaults
protected void installDefaults()Installs the defaults.- Overrides:
installDefaultsin classBasicTabbedPaneUI
-
installListeners
protected void installListeners()Installs the listeners.- Overrides:
installListenersin classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()Uninstalls the listeners.- Overrides:
uninstallListenersin classBasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()Uninstalls the defaults.- Overrides:
uninstallDefaultsin classBasicTabbedPaneUI
-
getContext
Returns the Context for the specified component.- Specified by:
getContextin interfaceSynthUI- Parameters:
c- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-
createScrollButton
Creates and returns a JButton that will provide the user with a way to scroll the tabs in a particular direction. The returned JButton must be instance of UIResource.- Overrides:
createScrollButtonin classBasicTabbedPaneUI- Parameters:
direction- One of the SwingConstants constants: SOUTH, NORTH, EAST or WEST- Returns:
- Widget for user to
- See Also:
-
propertyChange
This method gets called when a bound property is changed.- Specified by:
propertyChangein interfacePropertyChangeListener- Parameters:
e- A PropertyChangeEvent object describing the event source and the property that has changed.
-
createMouseListener
Creates a mouse listener. Overridden to keep track of whether the selected tab is also pressed.- Overrides:
createMouseListenerin classBasicTabbedPaneUI- Returns:
- a mouse listener
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift x.- Overrides:
getTabLabelShiftXin classBasicTabbedPaneUI- Parameters:
tabPlacement- the tab placementtabIndex- the tab indexisSelected- selection status- Returns:
- the tab label shift x
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift y.- Overrides:
getTabLabelShiftYin classBasicTabbedPaneUI- Parameters:
tabPlacement- the tab placementtabIndex- the tab indexisSelected- selection status- Returns:
- the tab label shift y
-
update
Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls thepaint(SynthContext,Graphics)method.In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the
paintmethod.- Overrides:
updatein classComponentUI- Parameters:
g- theGraphicsobject used for paintingc- the component being painted- See Also:
-
getBaseline
protected int getBaseline(int tab) Returns the baseline for the specified tab.- Overrides:
getBaselinein classBasicTabbedPaneUI- Parameters:
tab- index of tab to get baseline for- Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
-
paintBorder
Paints the border.- Specified by:
paintBorderin interfaceSynthUI- Parameters:
context- a component contextg-Graphicsto paint onx- the X coordinatey- the Y coordinatew- width of the borderh- height of the border
-
paint
Paints the specified component according to the Look and Feel.This method is not used by Synth Look and Feel. Painting is handled by the
paint(SynthContext,Graphics)method.- Overrides:
paintin classBasicTabbedPaneUI- Parameters:
g- theGraphicsobject used for paintingc- the component being painted- See Also:
-
paint
Paints the specified component.- Parameters:
context- context for the component being paintedg- theGraphicsobject used for painting- See Also:
-
paintTabArea
Description copied from class:BasicTabbedPaneUIPaints the tabs in the tab area. Invoked by paint(). The graphics parameter must be a validGraphicsobject. Tab placement may be either:JTabbedPane.TOP,JTabbedPane.BOTTOM,JTabbedPane.LEFT, orJTabbedPane.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.- Overrides:
paintTabAreain classBasicTabbedPaneUI- Parameters:
g- the graphics object to use for renderingtabPlacement- the placement for the tabs within the JTabbedPaneselectedIndex- the tab index of the selected component
-
setRolloverTab
protected void setRolloverTab(int index) Sets the tab the mouse is currently over toindex.indexwill 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.- Overrides:
setRolloverTabin classBasicTabbedPaneUI- Parameters:
index- Index of the tab the mouse is over.
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement) Calculates the maximum tab height.- Overrides:
calculateMaxTabHeightin classBasicTabbedPaneUI- Parameters:
tabPlacement- the placement (left, right, bottom, top) of the tab- Returns:
- the maximum tab height
-
calculateTabWidth
Calculates the tab width.- Overrides:
calculateTabWidthin classBasicTabbedPaneUI- Parameters:
tabPlacement- the placement (left, right, bottom, top) of the tabtabIndex- the index of the tab with respect to other tabsmetrics- the font metrics- Returns:
- the tab width
-
calculateMaxTabWidth
protected int calculateMaxTabWidth(int tabPlacement) Calculates the maximum tab width.- Overrides:
calculateMaxTabWidthin classBasicTabbedPaneUI- Parameters:
tabPlacement- the placement (left, right, bottom, top) of the tab- Returns:
- the maximum tab width
-
getTabInsets
Returns the tab insets.- Overrides:
getTabInsetsin classBasicTabbedPaneUI- Parameters:
tabPlacement- the placement (left, right, bottom, top) of the tabtabIndex- the tab index- Returns:
- the tab insets
-
getFontMetrics
Returns the font metrics.- Overrides:
getFontMetricsin classBasicTabbedPaneUI- Returns:
- the font metrics
-
createLayoutManager
Invoked byinstallUIto create a layout manager object to manage theJTabbedPane. Overridden to create a TabbedPaneLayout subclass which takes into account tabOverlap.- Overrides:
createLayoutManagerin classBasicTabbedPaneUI- Returns:
- a layout manager object
- See Also:
-