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 inherited from class BasicSliderUI
BasicSliderUI.ActionScroller, BasicSliderUI.ChangeHandler, BasicSliderUI.ComponentHandler, BasicSliderUI.FocusHandler, BasicSliderUI.PropertyChangeHandler, BasicSliderUI.ScrollListener, BasicSliderUI.TrackListener -
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 inherited from 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 -
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.protected DimensionReturns the thumb size.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.voidInstalls a UI.voidPaints focus.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 track.protected voidscrollDueToClickInTrack(int dir) This function is called when a mousePressed was detected in the track, not in the thumb.Methods inherited from 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, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installDefaults, installKeyboardActions, installListeners, isDragging, labelsHaveSameBaselines, paint, paintHorizontalLabel, paintLabels, paintTicks, paintVerticalLabel, recalculateIfInsetsChanged, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, setThumbLocation, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, valueForXPosition, valueForYPosition, xPositionForValue, yPositionForValue, yPositionForValueMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
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
-
installUI
Description copied from class:BasicSliderUIInstalls a UI.- Overrides:
installUIin classBasicSliderUI- Parameters:
c- a component- See Also:
-
createPropertyChangeListener
ConstructsMetalPropertyListener.- Overrides:
createPropertyChangeListenerin classBasicSliderUI- Parameters:
slider- aJSlider- Returns:
- the
MetalPropertyListener
-
paintThumb
Description copied from class:BasicSliderUIPaints the thumb.- Overrides:
paintThumbin classBasicSliderUI- Parameters:
g- the graphics
-
paintTrack
Description copied from class:BasicSliderUIPaints track.- Overrides:
paintTrackin classBasicSliderUI- Parameters:
g- the graphics
-
paintFocus
Description copied from class:BasicSliderUIPaints focus.- Overrides:
paintFocusin classBasicSliderUI- Parameters:
g- the graphics
-
getThumbSize
Description copied from class:BasicSliderUIReturns the thumb size.- Overrides:
getThumbSizein classBasicSliderUI- Returns:
- the thumb size
-
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
-
scrollDueToClickInTrack
protected void scrollDueToClickInTrack(int dir) Description copied from class:BasicSliderUIThis function is called when a mousePressed was detected in the track, not in the thumb. The default behavior is to scroll by block. You can override this method to stop it from scrolling or to add additional behavior.- Overrides:
scrollDueToClickInTrackin classBasicSliderUI- Parameters:
dir- the direction and number of blocks to scroll
-
paintMinorTickForHorizSlider
Description copied from class:BasicSliderUIPaints minor tick for horizontal slider.- Overrides:
paintMinorTickForHorizSliderin classBasicSliderUI- Parameters:
g- the graphicstickBounds- the tick boundsx- the x coordinate
-
paintMajorTickForHorizSlider
Description copied from class:BasicSliderUIPaints major tick for horizontal slider.- Overrides:
paintMajorTickForHorizSliderin classBasicSliderUI- Parameters:
g- the graphicstickBounds- the tick boundsx- the x coordinate
-
paintMinorTickForVertSlider
Description copied from class:BasicSliderUIPaints minor tick for vertical slider.- Overrides:
paintMinorTickForVertSliderin classBasicSliderUI- Parameters:
g- the graphicstickBounds- the tick boundsy- the y coordinate
-
paintMajorTickForVertSlider
Description copied from class:BasicSliderUIPaints major tick for vertical slider.- Overrides:
paintMajorTickForVertSliderin classBasicSliderUI- Parameters:
g- the graphicstickBounds- the tick boundsy- the y coordinate
-