Class MetalSliderUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.SliderUI
javax.swing.plaf.basic.BasicSliderUI
javax.swing.plaf.metal.MetalSliderUI
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
Nested ClassesModifier and TypeClassDescriptionprotected classPropertyListenerforJSlider.isFilled.Nested classes/interfaces declared in class BasicSliderUI
BasicSliderUI.ActionScroller, BasicSliderUI.ChangeHandler, BasicSliderUI.ComponentHandler, BasicSliderUI.FocusHandler, BasicSliderUI.PropertyChangeHandler, BasicSliderUI.ScrollListener, BasicSliderUI.TrackListenerModifier and TypeClassDescriptionclassAs of Java 2 platform v1.3 this undocumented class is no longer used.classData model listener.classListener for resizing events.classFocus-change listener.classA property change handler.classScroll-event listener.classTrack mouse movements. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static ColorThe color of dark shadow.protected booleanThe value of the propertyJSlider.isFilled.protected static ColorThe color of highlighting.protected static IconA default horizontal thumbIcon.protected final StringProperty forJSlider.isFilled.protected static ColorThe color of a thumbprotected final intThe buffer of a tick.protected static intThe length of a tick.protected static intThe width of a track.protected static IconA default vertical thumbIcon.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, trackRectModifier and TypeFieldDescriptionprotected ChangeListenerChange listenerprotected ComponentListenerComponent listenerprotected RectangleContent rectangleprotected InsetsFocus insetsprotected FocusListenerFocus listenerprotected RectangleFocus rectangleprotected InsetsInset cacheprotected RectangleLabel rectangleprotected booleanLeft-to-right cachestatic final intMaximum scrollstatic final intMinimum scrollstatic final intNegative scrollstatic final intPositive scrollprotected PropertyChangeListenerProperty change listenerprotected BasicSliderUI.ScrollListenerScroll listenerprotected TimerScroll timerprotected JSliderSliderprotected RectangleThumb rectangleprotected RectangleTick rectangleprotected intThe distance that the track is from the side of the controlprotected BasicSliderUI.TrackListenerTrack listenerprotected RectangleTrack rectangle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropertyChangeListenercreatePropertyChangeListener(JSlider slider) ConstructsMetalPropertyListener.static ComponentUIConstructs aMetalSliderUIinstance.protected intReturns the amount that the thumb goes past the slide bar.intGets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.protected intReturns the longer dimension of the slide bar.protected intReturns 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, yPositionForValueModifier and TypeMethodDescriptionprotected voidCalculates the content rectangle.protected voidCalculates the focus rectangle.protected voidCalculates the geometry.protected voidCalculates the label rectangle.protected voidCalculates the thumb location.protected voidCalculates the thumb size rectangle.protected voidCalculates the tick rectangle.protected voidCalculates the track buffer.protected voidCalculates the track rectangle.protected ChangeListenercreateChangeListener(JSlider slider) Creates a change listener.protected ComponentListenercreateComponentListener(JSlider slider) Creates a composite listener.protected FocusListenercreateFocusListener(JSlider slider) Creates a focus listener.protected BasicSliderUI.ScrollListenercreateScrollListener(JSlider slider) Creates a scroll listener.protected BasicSliderUI.TrackListenercreateTrackListener(JSlider slider) Creates a track listener.protected booleanDraws inverted.intgetBaseline(JComponent c, int width, int height) Returns the baseline.Returns an enum indicating how the baseline of the component changes as the size changes.protected ColorReturns the focus color.protected intReturns the height of the highest value label.protected intReturns the height of the lowest value label.protected intReturns the height of the tallest label.protected IntegerReturns the biggest value that has an entry in the label table.protected ComponentReturns the label that corresponds to the lowest slider value in the label table.protected ColorReturns the highlight color.protected IntegerReturns the smallest value that has an entry in the label table.protected ComponentReturns the label that corresponds to the highest slider value in the label table.Returns the maximum size.Returns the minimum horizontal size.Returns the minimum size.Returns the minimum vertical size.Returns the preferred horizontal size.Returns the preferred size.Returns the preferred vertical size.protected ColorReturns the shadow color.protected DimensionReturns the thumb size.protected intReturns the width of the highest value label.protected intReturns the width of the lowest value label.protected intReturns the width of the widest label.protected voidinstallDefaults(JSlider slider) Installs the defaults.protected voidinstallKeyboardActions(JSlider slider) Installs keyboard actions.protected voidinstallListeners(JSlider slider) Installs listeners.voidInstalls a UI.protected booleanReturns true if the user is dragging the slider.protected booleanReturns true if all the labels from the label table have the same baseline.voidPaints focus.protected voidpaintHorizontalLabel(Graphics g, int value, Component label) Called for every label in the label table.voidPaints the labels.protected voidpaintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) Paints major tick for horizontal slider.protected voidpaintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) Paints major tick for vertical slider.protected voidpaintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x) Paints minor tick for horizontal slider.protected voidpaintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y) Paints minor tick for vertical slider.voidPaints the thumb.voidPaints ticks.voidPaints track.protected voidpaintVerticalLabel(Graphics g, int value, Component label) Called for every label in the label table.protected voidRecalculates if the insets have changed.protected voidRecalculates if the orientation has changed.voidscrollByBlock(int direction) Scrolls by block.voidscrollByUnit(int direction) Scrolls by unit.protected voidscrollDueToClickInTrack(int dir) This function is called when a mousePressed was detected in the track, not in the thumb.voidsetThumbLocation(int x, int y) Sets the thumb location.protected voiduninstallDefaults(JSlider slider) Uninstalls the defaults.protected voiduninstallKeyboardActions(JSlider slider) Uninstalls keyboard actions.protected voiduninstallListeners(JSlider slider) Uninstalls listeners.voidUninstalls a UI.intvalueForXPosition(int xPos) Returns the value at the x position.intvalueForYPosition(int yPos) Returns the value at the y position.protected intxPositionForValue(int value) Returns the x position for a value.protected intyPositionForValue(int value) Returns the y position for a value.protected intyPositionForValue(int value, int trackY, int trackHeight) Returns the y location for the specified value.Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, paint, updateModifier and TypeMethodDescriptionbooleancontains(JComponent c, int x, int y) Returnstrueif 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 theithAccessiblechild of the object.intReturns the number of accessible children in the object.voidpaint(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.voidupdate(Graphics g, JComponent c) 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, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()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.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(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 voidwait(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.
-
Field Details
-
TICK_BUFFER
protected final int TICK_BUFFERThe buffer of a tick.- See Also:
-
filledSlider
protected boolean filledSliderThe value of the propertyJSlider.isFilled. By default,falseif the property is not set,truefor Ocean theme. -
thumbColor
The color of a thumb -
highlightColor
The color of highlighting. -
darkShadowColor
The color of dark shadow. -
trackWidth
protected static int trackWidthThe width of a track. -
tickLength
protected static int tickLengthThe length of a tick. -
horizThumbIcon
A default horizontal thumbIcon. This field might not be used. To change theIconused by this delegate directly set it using theSlider.horizontalThumbIconUIManager property. -
vertThumbIcon
A default vertical thumbIcon. This field might not be used. To change theIconused by this delegate directly set it using theSlider.verticalThumbIconUIManager property. -
SLIDER_FILL
-
-
Constructor Details
-
MetalSliderUI
public MetalSliderUI()Constructs aMetalSliderUIinstance.
-
-
Method Details
-
createUI
Constructs aMetalSliderUIinstance.- Parameters:
c- a component- Returns:
- a
MetalSliderUIinstance
-
createPropertyChangeListener
ConstructsMetalPropertyListener.- Overrides:
createPropertyChangeListenerin classBasicSliderUI- Parameters:
slider- aJSlider- 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:
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.- 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
-