Spec-Zone.ru › OpenJDK 27

Class SynthSliderUI

java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.SliderUI
javax.swing.plaf.basic.BasicSliderUI
javax.swing.plaf.synth.SynthSliderUI
All Implemented Interfaces:
PropertyChangeListener, EventListener, SynthConstants, SynthUI
public class SynthSliderUI extends BasicSliderUI implements PropertyChangeListener, SynthUI
Provides the Synth L&F UI delegate for JSlider.
Since:
1.7

Nested Class Summary

Nested classes/interfaces declared in class BasicSliderUI

BasicSliderUI.ActionScroller, BasicSliderUI.ChangeHandler, BasicSliderUI.ComponentHandler, BasicSliderUI.FocusHandler, BasicSliderUI.PropertyChangeHandler, BasicSliderUI.ScrollListener, BasicSliderUI.TrackListener
Modifier and Type Class Description
class  BasicSliderUI.ActionScroller
As of Java 2 platform v1.3 this undocumented class is no longer used.
class  BasicSliderUI.ChangeHandler
Data model listener.
class  BasicSliderUI.ComponentHandler
Listener for resizing events.
class  BasicSliderUI.FocusHandler
Focus-change listener.
class  BasicSliderUI.PropertyChangeHandler
A property change handler.
class  BasicSliderUI.ScrollListener
Scroll-event listener.
class  BasicSliderUI.TrackListener
Track mouse movements.

Field Summary

Fields declared in class BasicSliderUI

changeListener, componentListener, contentRect, focusInsets, focusListener, focusRect, insetCache, labelRect, leftToRightCache, MAX_SCROLL, MIN_SCROLL, NEGATIVE_SCROLL, POSITIVE_SCROLL, propertyChangeListener, scrollListener, scrollTimer, slider, thumbRect, tickRect, trackBuffer, trackListener, trackRect
Modifier and Type Field Description
protected ChangeListener changeListener
Change listener
protected ComponentListener componentListener
Component listener
protected Rectangle contentRect
Content rectangle
protected Insets focusInsets
Focus insets
protected FocusListener focusListener
Focus listener
protected Rectangle focusRect
Focus rectangle
protected Insets insetCache
Inset cache
protected Rectangle labelRect
Label rectangle
protected boolean leftToRightCache
Left-to-right cache
static final int MAX_SCROLL
Maximum scroll
static final int MIN_SCROLL
Minimum scroll
static final int NEGATIVE_SCROLL
Negative scroll
static final int POSITIVE_SCROLL
Positive scroll
protected PropertyChangeListener propertyChangeListener
Property change listener
protected BasicSliderUI.ScrollListener scrollListener
Scroll listener
protected Timer scrollTimer
Scroll timer
protected JSlider slider
Slider
protected Rectangle thumbRect
Thumb rectangle
protected Rectangle tickRect
Tick rectangle
protected int trackBuffer
The distance that the track is from the side of the control
protected BasicSliderUI.TrackListener trackListener
Track listener
protected Rectangle trackRect
Track rectangle

Fields declared in interface SynthConstants

DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
Modifier and Type Field Description
static final int DEFAULT
Indicates the region is the default.
static final int DISABLED
Primary state indicating the region is not enabled.
static final int ENABLED
Primary state indicating the component is enabled.
static final int FOCUSED
Indicates the region has focus.
static final int MOUSE_OVER
Primary state indicating the mouse is over the region.
static final int PRESSED
Primary state indicating the region is in a pressed state.
static final int SELECTED
Indicates the region is selected.

Constructor Summary

SynthSliderUI(JSlider c)
Modifier Constructor Description
protected
Constructs a SynthSliderUI.

Method Summary

Modifier and Type Method Description
static ComponentUI createUI(JComponent c)
Creates a new UI object for the given component.
SynthContext getContext(JComponent c)
Returns the Context for the specified component.
protected void layout()
Lays out the slider.
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 paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)
Paints the slider thumb.
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds)
Paints the slider track.
void propertyChange(PropertyChangeEvent e)
This method gets called when a bound property is changed.
protected void uninstallDefaults(JSlider slider)
Uninstalls default setting.
void update(Graphics g, JComponent c)
Notifies this UI delegate to repaint the specified component.

Methods declared in class BasicSliderUI

calculateContentRect, calculateFocusRect, calculateGeometry, calculateLabelRect, calculateThumbLocation, calculateThumbSize, calculateTickRect, calculateTrackBuffer, calculateTrackRect, createChangeListener, createComponentListener, createFocusListener, createPropertyChangeListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredSize, getPreferredVerticalSize, getShadowColor, getThumbSize, getTickLength, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installDefaults, installKeyboardActions, installListeners, installUI, isDragging, labelsHaveSameBaselines, paintFocus, paintHorizontalLabel, paintLabels, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintThumb, paintTicks, paintTrack, paintVerticalLabel, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, setThumbLocation, uninstallKeyboardActions, uninstallListeners, uninstallUI, valueForXPosition, valueForYPosition, xPositionForValue, yPositionForValue, yPositionForValue
Modifier and Type Method Description
protected void calculateContentRect()
Calculates the content rectangle.
protected void calculateFocusRect()
Calculates the focus rectangle.
protected void calculateGeometry()
Calculates the geometry.
protected void calculateLabelRect()
Calculates the label rectangle.
protected void calculateThumbLocation()
Calculates the thumb location.
protected void calculateThumbSize()
Calculates the thumb size rectangle.
protected void calculateTickRect()
Calculates the tick rectangle.
protected void calculateTrackBuffer()
Calculates the track buffer.
protected void calculateTrackRect()
Calculates the track rectangle.
protected ChangeListener createChangeListener(JSlider slider)
Creates a change listener.
protected ComponentListener createComponentListener(JSlider slider)
Creates a composite listener.
protected FocusListener createFocusListener(JSlider slider)
Creates a focus listener.
protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
Creates a property change listener.
protected BasicSliderUI.ScrollListener createScrollListener(JSlider slider)
Creates a scroll listener.
protected BasicSliderUI.TrackListener createTrackListener(JSlider slider)
Creates a track listener.
protected boolean drawInverted()
Draws inverted.
int getBaseline(JComponent c, int width, int height)
Returns the baseline.
Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
Returns an enum indicating how the baseline of the component changes as the size changes.
protected Color getFocusColor()
Returns the focus color.
protected int getHeightOfHighValueLabel()
Returns the height of the highest value label.
protected int getHeightOfLowValueLabel()
Returns the height of the lowest value label.
protected int getHeightOfTallestLabel()
Returns the height of the tallest label.
protected Integer getHighestValue()
Returns the biggest value that has an entry in the label table.
protected Component getHighestValueLabel()
Returns the label that corresponds to the lowest slider value in the label table.
protected Color getHighlightColor()
Returns the highlight color.
protected Integer getLowestValue()
Returns the smallest value that has an entry in the label table.
protected Component getLowestValueLabel()
Returns the label that corresponds to the highest slider value in the label table.
Dimension getMaximumSize(JComponent c)
Returns the maximum size.
Dimension getMinimumHorizontalSize()
Returns the minimum horizontal size.
Dimension getMinimumSize(JComponent c)
Returns the minimum size.
Dimension getMinimumVerticalSize()
Returns the minimum vertical size.
Dimension getPreferredHorizontalSize()
Returns the preferred horizontal size.
Dimension getPreferredSize(JComponent c)
Returns the preferred size.
Dimension getPreferredVerticalSize()
Returns the preferred vertical size.
protected Color getShadowColor()
Returns the shadow color.
protected Dimension getThumbSize()
Returns the thumb size.
protected int getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.
protected int getWidthOfHighValueLabel()
Returns the width of the highest value label.
protected int getWidthOfLowValueLabel()
Returns the width of the lowest value label.
protected int getWidthOfWidestLabel()
Returns the width of the widest label.
protected void installDefaults(JSlider slider)
Installs the defaults.
protected void installKeyboardActions(JSlider slider)
Installs keyboard actions.
protected void installListeners(JSlider slider)
Installs listeners.
void installUI(JComponent c)
Installs a UI.
protected boolean isDragging()
Returns true if the user is dragging the slider.
protected boolean labelsHaveSameBaselines()
Returns true if all the labels from the label table have the same baseline.
void paintFocus(Graphics g)
Paints focus.
protected void paintHorizontalLabel(Graphics g, int value, Component label)
Called for every label in the label table.
void paintLabels(Graphics g)
Paints the labels.
protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
Paints major tick for horizontal slider.
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
Paints major tick for vertical slider.
protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
Paints minor tick for horizontal slider.
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
Paints minor tick for vertical slider.
void paintThumb(Graphics g)
Paints the thumb.
void paintTicks(Graphics g)
Paints ticks.
void paintTrack(Graphics g)
Paints track.
protected void paintVerticalLabel(Graphics g, int value, Component label)
Called for every label in the label table.
protected void recalculateIfInsetsChanged()
Recalculates if the insets have changed.
protected void recalculateIfOrientationChanged()
Recalculates if the orientation has changed.
void scrollByBlock(int direction)
Scrolls by block.
void scrollByUnit(int direction)
Scrolls by unit.
protected void scrollDueToClickInTrack(int dir)
This function is called when a mousePressed was detected in the track, not in the thumb.
void setThumbLocation(int x, int y)
Sets the thumb location.
protected void uninstallKeyboardActions(JSlider slider)
Uninstalls keyboard actions.
protected void uninstallListeners(JSlider slider)
Uninstalls listeners.
void uninstallUI(JComponent c)
Uninstalls a UI.
int valueForXPosition(int xPos)
Returns the value at the x position.
int valueForYPosition(int yPos)
Returns the value at the y position.
protected int xPositionForValue(int value)
Returns the x position for a value.
protected int yPositionForValue(int value)
Returns the y position for a value.
protected int yPositionForValue(int value, int trackY, int trackHeight)
Returns the y location for the specified value.

Methods declared in class ComponentUI

contains, getAccessibleChild, getAccessibleChildrenCount
Modifier and Type Method Description
boolean contains(JComponent c, int x, int y)
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component.
Accessible getAccessibleChild(JComponent c, int i)
Returns the ith Accessible child of the object.
int getAccessibleChildrenCount(JComponent c)
Returns the number of accessible children in the object.

Methods declared in class Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and Type Method Description
protected Object clone()
Creates and returns a copy of this object.
boolean equals(Object obj)
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 this Object.
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 notifyAll()
Wakes up all threads that are waiting on this object's monitor.
String 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

SynthSliderUI

protected SynthSliderUI(JSlider c)
Constructs a SynthSliderUI.
Parameters:
c - a slider

Method Details

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

uninstallDefaults

protected void uninstallDefaults(JSlider slider)
Uninstalls default setting. This method is called when a LookAndFeel is uninstalled.
Overrides:
uninstallDefaults in class BasicSliderUI
Parameters:
slider - a slider

layout

protected void layout()
Lays out the slider.

getContext

public SynthContext getContext(JComponent c)
Returns the Context for the specified component.
Specified by:
getContext in interface SynthUI
Parameters:
c - Component requesting SynthContext.
Returns:
SynthContext describing component.

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 the paint(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 class ComponentUI
Parameters:
g - the Graphics object used for painting
c - the component being painted
See Also:
  • paint(SynthContext,Graphics)

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 class ComponentUI
Parameters:
g - the Graphics object used for painting
c - 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 painted
g - the Graphics object used for painting
See Also:
  • update(Graphics,JComponent)

paintBorder

public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
Paints the border.
Specified by:
paintBorder in interface SynthUI
Parameters:
context - a component context
g - Graphics to paint on
x - the X coordinate
y - the Y coordinate
w - width of the border
h - height of the border

paintThumb

protected void paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)
Paints the slider thumb.
Parameters:
context - context for the component being painted
g - Graphics object used for painting
thumbBounds - bounding box for the thumb

paintTrack

protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds)
Paints the slider track.
Parameters:
context - context for the component being painted
g - Graphics object used for painting
trackBounds - bounding box for the track

propertyChange

public void propertyChange(PropertyChangeEvent e)
This method gets called when a bound property is changed.
Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - A PropertyChangeEvent object describing the event source and the property that has changed.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2026, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API