W3cubDocs

/OpenJDK 21

Class MetalSliderUI

public class MetalSliderUI extends BasicSliderUI
A Java L&F implementation of SliderUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.

Nested Class Summary

Modifier and Type Class Description
protected class  MetalSliderUI.MetalPropertyListener
PropertyListener for JSlider.isFilled.

Field Summary

Modifier and Type Field Description
protected static Color darkShadowColor
The color of dark shadow.
protected boolean filledSlider
The value of the property JSlider.isFilled.
protected static Color highlightColor
The color of highlighting.
protected static Icon horizThumbIcon
A default horizontal thumb Icon.
protected final String SLIDER_FILL
Property for JSlider.isFilled.
protected static Color thumbColor
The color of a thumb
protected final int TICK_BUFFER
The buffer of a tick.
protected static int tickLength
The length of a tick.
protected static int trackWidth
The width of a track.
protected static Icon vertThumbIcon
A default vertical thumb Icon.

Constructor Summary

Constructor Description
MetalSliderUI()
Constructs a MetalSliderUI instance.

Method Summary

Modifier and Type Method Description
protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
Constructs MetalPropertyListener.
static ComponentUI createUI(JComponent c)
Constructs a MetalSliderUI instance.
protected int getThumbOverhang()
Returns the amount that the thumb goes past the slide bar.
int getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.
protected int getTrackLength()
Returns the longer dimension of the slide bar.
protected int getTrackWidth()
Returns the shorter dimension of the track.

Methods declared in class javax.swing.plaf.ComponentUI

contains, getAccessibleChild, getAccessibleChildrenCount, paint, update

Methods declared in class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

TICK_BUFFER

protected final int TICK_BUFFER
The buffer of a tick.
See Also:

filledSlider

protected boolean filledSlider
The value of the property JSlider.isFilled. By default, false if the property is not set, true for Ocean theme.

thumbColor

protected static Color thumbColor
The color of a thumb

highlightColor

protected static Color highlightColor
The color of highlighting.

darkShadowColor

protected static Color darkShadowColor
The color of dark shadow.

trackWidth

protected static int trackWidth
The width of a track.

tickLength

protected static int tickLength
The length of a tick.

horizThumbIcon

protected static Icon horizThumbIcon
A default horizontal thumb Icon. This field might not be used. To change the Icon used by this delegate directly set it using the Slider.horizontalThumbIcon UIManager property.

vertThumbIcon

protected static Icon vertThumbIcon
A default vertical thumb Icon. This field might not be used. To change the Icon used by this delegate directly set it using the Slider.verticalThumbIcon UIManager property.

SLIDER_FILL

protected final String SLIDER_FILL
Property for JSlider.isFilled.
See Also:

Constructor Details

MetalSliderUI

public MetalSliderUI()
Constructs a MetalSliderUI instance.

Method Details

createUI

public static ComponentUI createUI(JComponent c)
Constructs a MetalSliderUI instance.
Parameters:
c - a component
Returns:
a MetalSliderUI instance

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
Constructs MetalPropertyListener.
Overrides:
createPropertyChangeListener in class BasicSliderUI
Parameters:
slider - a JSlider
Returns:
the MetalPropertyListener

getTickLength

public int getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders. BasicSliderUI uses the returned value to determine the tick area rectangle.
Overrides:
getTickLength in class BasicSliderUI
Returns:
an integer representing the height of the tick area for horizontal sliders, and the width of the tick area for the vertical sliders

getTrackWidth

protected int getTrackWidth()
Returns the shorter dimension of the track.
Returns:
the shorter dimension of the track

getTrackLength

protected int getTrackLength()
Returns the longer dimension of the slide bar. (The slide bar is only the part that runs directly under the thumb)
Returns:
the longer dimension of the slide bar

getThumbOverhang

protected int getThumbOverhang()
Returns the amount that the thumb goes past the slide bar.
Returns:
the amount that the thumb goes past the slide bar

© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/plaf/metal/MetalSliderUI.html