- 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
public class SynthTabbedPaneUI extends BasicTabbedPaneUI implements PropertyChangeListener, SynthUI
Provides the Synth L&F UI delegate forJTabbedPane
.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 javax.swing.plaf.basic.BasicTabbedPaneUI
BasicTabbedPaneUI.FocusHandler, BasicTabbedPaneUI.MouseHandler, BasicTabbedPaneUI.PropertyChangeHandler, BasicTabbedPaneUI.TabbedPaneLayout, BasicTabbedPaneUI.TabSelectionHandler
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.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
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
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
Constructors Constructor and Description SynthTabbedPaneUI()
-
Method Summary
Methods Modifier and Type Method and Description protected int
calculateMaxTabHeight(int tabPlacement)
protected int
calculateMaxTabWidth(int tabPlacement)
protected int
calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
protected LayoutManager
createLayoutManager()
Invoked byinstallUI
to create a layout manager object to manage theJTabbedPane
.protected MouseListener
createMouseListener()
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 c)
Creates a new UI object for the given component.protected int
getBaseline(int tab)
Returns the baseline for the specified tab.SynthContext
getContext(JComponent c)
Returns the Context for the specified component.protected FontMetrics
getFontMetrics()
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)
protected void
installDefaults()
protected void
installListeners()
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.protected void
paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
Paints the tabs in the tab area.void
propertyChange(PropertyChangeEvent e)
This method gets called when a bound property is changed.protected void
setRolloverTab(int index)
Sets the tab the mouse is currently over toindex
.protected void
uninstallDefaults()
protected void
uninstallListeners()
void
update(Graphics g, JComponent c)
Notifies this UI delegate to repaint the specified component.-
Methods inherited from class javax.swing.plaf.basic.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, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize
-
-
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent c)
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()
- Overrides:
installDefaults
in classBasicTabbedPaneUI
-
installListeners
protected void installListeners()
- Overrides:
installListeners
in classBasicTabbedPaneUI
-
uninstallListeners
protected void uninstallListeners()
- Overrides:
uninstallListeners
in classBasicTabbedPaneUI
-
uninstallDefaults
protected void uninstallDefaults()
- Overrides:
uninstallDefaults
in classBasicTabbedPaneUI
-
getContext
public SynthContext getContext(JComponent c)
Description copied from interface:SynthUI
Returns the Context for the specified component.- Specified by:
getContext
in interfaceSynthUI
- Parameters:
c
- Component requesting SynthContext.- Returns:
- SynthContext describing component.
-
createScrollButton
protected JButton createScrollButton(int direction)
Description copied from class:BasicTabbedPaneUI
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:
createScrollButton
in classBasicTabbedPaneUI
- Parameters:
direction
- One of the SwingConstants constants: SOUTH, NORTH, EAST or WEST- Returns:
- Widget for user to
- See Also:
JTabbedPane.setTabPlacement(int)
,SwingConstants
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
Description copied from interface:PropertyChangeListener
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
protected MouseListener createMouseListener()
- Overrides:
createMouseListener
in classBasicTabbedPaneUI
-
getTabLabelShiftX
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
- Overrides:
getTabLabelShiftX
in classBasicTabbedPaneUI
-
getTabLabelShiftY
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
- Overrides:
getTabLabelShiftY
in classBasicTabbedPaneUI
-
update
public void update(Graphics g, JComponent c)
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:
paint(SynthContext,Graphics)
-
getBaseline
protected int getBaseline(int tab)
Description copied from class:BasicTabbedPaneUI
Returns the baseline for the specified tab.- Overrides:
getBaseline
in classBasicTabbedPaneUI
- Parameters:
tab
- index of tab to get baseline for- Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
-
paintBorder
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
Description copied from interface:SynthUI
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
public void paint(Graphics g, JComponent c)
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 classBasicTabbedPaneUI
- Parameters:
g
- theGraphics
object used for paintingc
- the component being painted- See Also:
paint(SynthContext,Graphics)
-
paint
protected void paint(SynthContext context, Graphics g)
Paints the specified component.- Parameters:
context
- context for the component being paintedg
- theGraphics
object used for painting- See Also:
update(Graphics,JComponent)
-
paintTabArea
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
Description copied from class:BasicTabbedPaneUI
Paints the tabs in the tab area. Invoked by paint(). The graphics parameter must be a validGraphics
object. 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:
paintTabArea
in 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)
Description copied from class:BasicTabbedPaneUI
Sets the tab the mouse is currently over toindex
.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.- Overrides:
setRolloverTab
in classBasicTabbedPaneUI
- Parameters:
index
- Index of the tab the mouse is over.
-
calculateMaxTabHeight
protected int calculateMaxTabHeight(int tabPlacement)
- Overrides:
calculateMaxTabHeight
in classBasicTabbedPaneUI
-
calculateTabWidth
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
- Overrides:
calculateTabWidth
in classBasicTabbedPaneUI
-
calculateMaxTabWidth
protected int calculateMaxTabWidth(int tabPlacement)
- Overrides:
calculateMaxTabWidth
in classBasicTabbedPaneUI
-
getTabInsets
protected Insets getTabInsets(int tabPlacement, int tabIndex)
- Overrides:
getTabInsets
in classBasicTabbedPaneUI
-
getFontMetrics
protected FontMetrics getFontMetrics()
- Overrides:
getFontMetrics
in classBasicTabbedPaneUI
-
createLayoutManager
protected LayoutManager createLayoutManager()
Description copied from class:BasicTabbedPaneUI
Invoked byinstallUI
to create a layout manager object to manage theJTabbedPane
.- Overrides:
createLayoutManager
in classBasicTabbedPaneUI
- Returns:
- a layout manager object
- See Also:
BasicTabbedPaneUI.TabbedPaneLayout
,JTabbedPane.getTabLayoutPolicy()
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/plaf/synth/SynthTabbedPaneUI.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.