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 declared in class BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabbedPaneLayout, BasicTabbedPaneUI.TabSelectionHandler
Modifier and TypeClassDescriptionclass
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class. -
Field Summary
Fields declared in 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, upKey
Modifier and TypeFieldDescriptionprotected Rectangle
A rectangle used for general layout calculations in order to avoid constructing many new Rectangles on the fly.protected Insets
Content border insetsprotected Color
Dark shadow colorprotected KeyStroke
Deprecated.As of Java 2 platform v1.3.protected Color
Focus colorprotected FocusListener
Focus change listenerprotected Color
Highlight colorprotected KeyStroke
Deprecated.As of Java 2 platform v1.3.protected Color
Light highlight colorprotected int
Maximum tab heightprotected int
Maximum tab widthprotected MouseListener
Mouse change listenerprotected PropertyChangeListener
Property change listenerprotected Rectangle[]
Tab rectsprotected KeyStroke
Deprecated.As of Java 2 platform v1.3.protected int
Run countprotected int
Selected runprotected Insets
Selected tab insetsprotected Color
Shadow colorprotected Insets
Tab area insetsprotected ChangeListener
Tab change listenerprotected Insets
Tab insetsprotected JTabbedPane
The tab paneprotected int
Tab run overlayprotected int[]
Tab runsprotected int
Text icon gapprotected KeyStroke
Deprecated.As of Java 2 platform v1.3.Fields declared in interface SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Modifier and TypeFieldDescriptionstatic final int
Box-orientation constant used to specify the bottom of a box.static final int
The central position in an area.static final int
Compass-direction east (right).static final int
Horizontal orientation.static final int
Identifies the leading edge of text for use with left-to-right and right-to-left languages.static final int
Box-orientation constant used to specify the left side of a box.static final int
Identifies the next direction in a sequence.static final int
Compass-direction North (up).static final int
Compass-direction north-east (upper right).static final int
Compass-direction north west (upper left).static final int
Identifies the previous direction in a sequence.static final int
Box-orientation constant used to specify the right side of a box.static final int
Compass-direction south (down).static final int
Compass-direction south-east (lower right).static final int
Compass-direction south-west (lower left).static final int
Box-orientation constant used to specify the top of a box.static final int
Identifies the trailing edge of text for use with left-to-right and right-to-left languages.static final int
Vertical orientation.static final int
Compass-direction west (left).Fields declared in interface SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Modifier and TypeFieldDescriptionstatic final int
Indicates the region is the default.static final int
Primary state indicating the region is not enabled.static final int
Primary state indicating the component is enabled.static final int
Indicates the region has focus.static final int
Primary state indicating the mouse is over the region.static final int
Primary state indicating the region is in a pressed state.static final int
Indicates the region is selected. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LayoutManager
Invoked byinstallUI
to create a layout manager object to manage theJTabbedPane
.protected MouseListener
Creates a mouse listener.static ComponentUI
Creates a new UI object for the given component.Returns the Context for the specified component.void
paint
(Graphics g, JComponent c) Paints the specified component according to the Look and Feel.protected void
paint
(SynthContext context, Graphics g) Paints the specified component.void
paintBorder
(SynthContext context, Graphics g, int x, int y, int w, int h) Paints the border.void
This method gets called when a bound property is changed.void
update
(Graphics g, JComponent c) Notifies this UI delegate to repaint the specified component.Methods declared in class BasicTabbedPaneUI
assureRectsCreated, calculateMaxTabHeight, calculateMaxTabWidth, calculateTabAreaHeight, calculateTabAreaWidth, calculateTabHeight, calculateTabWidth, createChangeListener, createFocusListener, createPropertyChangeListener, createScrollButton, expandTabRunsArray, getBaseline, getBaseline, getBaselineOffset, getBaselineResizeBehavior, getContentBorderInsets, getFocusIndex, getFontMetrics, getIconForTab, getNextTabIndex, getNextTabIndexInRun, getNextTabRun, getPreviousTabIndex, getPreviousTabIndexInRun, getPreviousTabRun, getRolloverTab, getRunForTab, getSelectedTabPadInsets, getTabAreaInsets, getTabBounds, getTabBounds, getTabInsets, getTabLabelShiftX, getTabLabelShiftY, getTabRunCount, getTabRunIndent, getTabRunOffset, getTabRunOverlay, getTextViewForTab, getVisibleComponent, installComponents, installDefaults, installKeyboardActions, installListeners, lastTabInRun, layoutLabel, navigateSelectedTab, paintContentBorder, paintContentBorderBottomEdge, paintContentBorderLeftEdge, paintContentBorderRightEdge, paintContentBorderTopEdge, paintFocusIndicator, paintIcon, paintTab, paintTabArea, paintTabBackground, paintTabBorder, paintText, rotateInsets, selectAdjacentRunTab, selectNextTab, selectNextTabInRun, selectPreviousTab, selectPreviousTabInRun, setRolloverTab, setVisibleComponent, shouldPadTabRun, shouldRotateTabRuns, tabForCoordinate, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
Modifier and TypeMethodDescriptionprotected void
assureRectsCreated
(int tabCount) Assures the tab rectangles are created.protected int
calculateMaxTabHeight
(int tabPlacement) Calculates the maximum tab height.protected int
calculateMaxTabWidth
(int tabPlacement) Calculates the maximum tab width.protected int
calculateTabAreaHeight
(int tabPlacement, int horizRunCount, int maxTabHeight) Calculates the tab area height.protected int
calculateTabAreaWidth
(int tabPlacement, int vertRunCount, int maxTabWidth) Calculates the tab area width.protected int
calculateTabHeight
(int tabPlacement, int tabIndex, int fontHeight) Calculates the tab height.protected int
calculateTabWidth
(int tabPlacement, int tabIndex, FontMetrics metrics) Calculates the tab width.protected ChangeListener
Creates a change listener.protected FocusListener
Creates a focus listener.protected PropertyChangeListener
Creates a property change listener.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.protected void
Expands the tab runs array.protected int
getBaseline
(int tab) Returns the baseline for the specified tab.int
getBaseline
(JComponent c, int width, int height) Returns the baseline.protected int
Returns the amount the baseline is offset by.Returns an enum indicating how the baseline of the component changes as the size changes.protected Insets
getContentBorderInsets
(int tabPlacement) Returns the content border insets.protected int
Returns the index of the tab that has focus.protected FontMetrics
Returns the font metrics.protected Icon
getIconForTab
(int tabIndex) Returns the icon for a tab.protected int
getNextTabIndex
(int base) Returns the next tab index.protected int
getNextTabIndexInRun
(int tabCount, int base) Returns the next tab index in the run.protected int
getNextTabRun
(int baseRun) Returns the next tab run.protected int
getPreviousTabIndex
(int base) Returns the previous tab index.protected int
getPreviousTabIndexInRun
(int tabCount, int base) Returns the previous tab index in the run.protected int
getPreviousTabRun
(int baseRun) Returns the previous tab run.protected int
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) Returns the run for a tab.protected Insets
getSelectedTabPadInsets
(int tabPlacement) Returns the selected tab pad insets.protected Insets
getTabAreaInsets
(int tabPlacement) Returns the tab area insets.protected Rectangle
getTabBounds
(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.protected Insets
getTabInsets
(int tabPlacement, int tabIndex) Returns the tab insets.protected int
getTabLabelShiftX
(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift x.protected int
getTabLabelShiftY
(int tabPlacement, int tabIndex, boolean isSelected) Returns the tab label shift y.int
getTabRunCount
(JTabbedPane pane) Returns the tab run count.protected int
getTabRunIndent
(int tabPlacement, int run) Returns the tab run indent.protected int
getTabRunOffset
(int tabPlacement, int tabCount, int tabIndex, boolean forward) Returns the tab run offset.protected int
getTabRunOverlay
(int tabPlacement) Returns the tab run overlay.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
Returns the visible component.protected void
Creates and installs any required subcomponents for the JTabbedPane.protected void
Installs the defaults.protected void
Installs the keyboard actions.protected void
Installs the listeners.protected int
lastTabInRun
(int tabCount, int run) Returns the last tab in a run.protected void
layoutLabel
(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) Lays out a label.protected void
navigateSelectedTab
(int direction) Navigates the selected tab.protected void
paintContentBorder
(Graphics g, int tabPlacement, int selectedIndex) Paints the content border.protected void
paintContentBorderBottomEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border bottom edge.protected void
paintContentBorderLeftEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border left edge.protected void
paintContentBorderRightEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border right edge.protected void
paintContentBorderTopEdge
(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) Paints the content border top edge.protected void
paintFocusIndicator
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) Paints the focus indicator.protected void
paintIcon
(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) Paints an icon.protected void
paintTab
(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) Paints a tab.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) Paints the tab background.protected void
paintTabBorder
(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) Paints the border around a tab.protected void
paintText
(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) Paints text.protected static void
rotateInsets
(Insets topInsets, Insets targetInsets, int targetPlacement) Rotates the insets.protected void
selectAdjacentRunTab
(int tabPlacement, int tabIndex, int offset) Selects an adjacent run of tabs.protected void
selectNextTab
(int current) Selects the next tab.protected void
selectNextTabInRun
(int current) Selects the next tab in the run.protected void
selectPreviousTab
(int current) Selects the previous tab.protected void
selectPreviousTabInRun
(int current) Selects the previous tab in the run.protected void
setRolloverTab
(int index) Sets the tab the mouse is currently over toindex
.protected void
setVisibleComponent
(Component component) Sets the visible component.protected boolean
shouldPadTabRun
(int tabPlacement, int run) Returns whether or not the tab run should be padded.protected boolean
shouldRotateTabRuns
(int tabPlacement) Returns whether or not the tab run 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
Removes any installed subcomponents from the JTabbedPane.protected void
Uninstalls the defaults.protected void
Uninstalls the keyboard actions.protected void
Uninstalls the listeners.Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, uninstallUI
Modifier and TypeMethodDescriptionboolean
contains
(JComponent c, int x, int y) Returnstrue
if 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 thei
thAccessible
child of the object.int
Returns the number of accessible children in the object.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.Returns the specified component's preferred size appropriate for the look and feel.void
Configures the specified component appropriately for the look and feel.void
Reverses configuration which was done on the specified component duringinstallUI
.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
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
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(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 void
wait
(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
-
getContext
Returns the Context for the specified component.- Specified by:
getContext
in interfaceSynthUI
- Parameters:
c
- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-
propertyChange
This method gets called when a bound property is changed.- Specified by:
propertyChange
in 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:
createMouseListener
in classBasicTabbedPaneUI
- Returns:
- a mouse listener
-
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
paint
method.- Overrides:
update
in classComponentUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
-
paintBorder
Paints the border.- Specified by:
paintBorder
in interfaceSynthUI
- Parameters:
context
- a component contextg
-Graphics
to 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:
paint
in classComponentUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
-
paint
Paints the specified component.- Parameters:
context
- context for the component being paintedg
- theGraphics
object used for painting- See Also:
-
createLayoutManager
Invoked byinstallUI
to create a layout manager object to manage theJTabbedPane
. Overridden to create a TabbedPaneLayout subclass which takes into account tabOverlap.- Overrides:
createLayoutManager
in classBasicTabbedPaneUI
- Returns:
- a layout manager object
- See Also:
-