Class MetalSliderUI
public class MetalSliderUI extends BasicSliderUI
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. |
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
| 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. |
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 |
Constructor Summary
| Constructor | Description |
|---|---|
MetalSliderUI() |
Constructs a MetalSliderUI instance. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
protected PropertyChangeListener |
createPropertyChangeListener |
Constructs MetalPropertyListener. |
static ComponentUI |
createUI |
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 BasicSliderUI
calculateContentRect, calculateFocusRect, calculateGeometry, calculateLabelRect, calculateThumbLocation, calculateThumbSize, calculateTickRect, calculateTrackBuffer, calculateTrackRect, createChangeListener, createComponentListener, createFocusListener, createScrollListener, createTrackListener, drawInverted, getBaseline, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredSize, getPreferredVerticalSize, getShadowColor, getThumbSize, 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, uninstallDefaults, 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 |
Creates a change listener. |
protected ComponentListener |
createComponentListener |
Creates a composite listener. |
protected FocusListener |
createFocusListener |
Creates a focus listener. |
protected BasicSliderUI.ScrollListener |
createScrollListener |
Creates a scroll listener. |
protected BasicSliderUI.TrackListener |
createTrackListener |
Creates a track listener. |
protected boolean |
drawInverted() |
Draws inverted. |
int |
getBaseline |
Returns the baseline. |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior |
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 |
Returns the maximum size. |
Dimension |
getMinimumHorizontalSize() |
Returns the minimum horizontal size. |
Dimension |
getMinimumSize |
Returns the minimum size. |
Dimension |
getMinimumVerticalSize() |
Returns the minimum vertical size. |
Dimension |
getPreferredHorizontalSize() |
Returns the preferred horizontal size. |
Dimension |
getPreferredSize |
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 |
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 |
Installs the defaults. |
protected void |
installKeyboardActions |
Installs keyboard actions. |
protected void |
installListeners |
Installs listeners. |
void |
installUI |
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 |
Paints focus. |
protected void |
paintHorizontalLabel |
Called for every label in the label table. |
void |
paintLabels |
Paints the labels. |
protected void |
paintMajorTickForHorizSlider |
Paints major tick for horizontal slider. |
protected void |
paintMajorTickForVertSlider |
Paints major tick for vertical slider. |
protected void |
paintMinorTickForHorizSlider |
Paints minor tick for horizontal slider. |
protected void |
paintMinorTickForVertSlider |
Paints minor tick for vertical slider. |
void |
paintThumb |
Paints the thumb. |
void |
paintTicks |
Paints ticks. |
void |
paintTrack |
Paints track. |
protected void |
paintVerticalLabel |
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 |
Scrolls by block. |
void |
scrollByUnit |
Scrolls by unit. |
protected void |
scrollDueToClickInTrack |
This function is called when a mousePressed was detected in the track, not in the thumb. |
void |
setThumbLocation |
Sets the thumb location. |
protected void |
uninstallDefaults |
Uninstalls the defaults. |
protected void |
uninstallKeyboardActions |
Uninstalls keyboard actions. |
protected void |
uninstallListeners |
Uninstalls listeners. |
void |
uninstallUI |
Uninstalls a UI. |
int |
valueForXPosition |
Returns the value at the x position. |
int |
valueForYPosition |
Returns the value at the y position. |
protected int |
xPositionForValue |
Returns the x position for a value. |
protected int |
yPositionForValue |
Returns the y position for a value. |
protected int |
yPositionForValue |
Returns the y location for the specified value. |
Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, paint, update | Modifier and Type | Method | Description |
|---|---|---|
boolean |
contains |
Returns true if the specified x,y location is contained within the look and feel's defined shape of the specified component. |
Accessible |
getAccessibleChild |
Returns the ith Accessible child of the object. |
int |
getAccessibleChildrenCount |
Returns the number of accessible children in the object. |
void |
paint |
Paints the specified component appropriately for the look and feel. |
void |
update |
Notifies this UI delegate that it is time to paint the specified component. |
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 |
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 |
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 |
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. |
Field Details
TICK_BUFFER
protected final int TICK_BUFFER
- See Also:
filledSlider
protected boolean filledSlider
JSlider.isFilled. By default, false if the property is not set, true for Ocean theme.thumbColor
protected static Color thumbColor
highlightColor
protected static Color highlightColor
darkShadowColor
protected static Color darkShadowColor
trackWidth
protected static int trackWidth
tickLength
protected static int tickLength
horizThumbIcon
protected static Icon horizThumbIcon
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
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
JSlider.isFilled.- See Also:
Constructor Details
MetalSliderUI
public MetalSliderUI()
MetalSliderUI instance.Method Details
createUI
public static ComponentUI createUI(JComponent c)
MetalSliderUI instance.- Parameters:
-
c- a component - Returns:
- a
MetalSliderUIinstance
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
MetalPropertyListener.- Overrides:
-
createPropertyChangeListenerin classBasicSliderUI - Parameters:
-
slider- aJSlider - Returns:
- the
MetalPropertyListener
getTickLength
public int getTickLength()
- Overrides:
-
getTickLengthin classBasicSliderUI - 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
getTrackLength
protected int getTrackLength()
- Returns:
- the longer dimension of the slide bar
getThumbOverhang
protected int getThumbOverhang()
- Returns:
- the amount that the thumb goes past the slide bar
© 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.