Package PamView.sliders
Class PamRangeSliderUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.SliderUI
javax.swing.plaf.basic.BasicSliderUI
PamView.sliders.PamSliderUI
PamView.sliders.PamRangeSliderUI
- Direct Known Subclasses:
ColourRangeSliderUI
UI delegate for the RangeSlider component. RangeSliderUI paints two thumbs,
one for the lower value and one for the upper value.
PamRangeSliderUI is based on code from Ernie Yu. http://ernienotes.wordpress.com/2010/12/27/creating-a-java-swing-range-slider/ (28/09/2013)
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Listener to handle model change events.class
Listener to handle mouse movements in the slider track.Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicSliderUI
BasicSliderUI.ActionScroller, BasicSliderUI.ComponentHandler, BasicSliderUI.FocusHandler, BasicSliderUI.PropertyChangeHandler, BasicSliderUI.ScrollListener, BasicSliderUI.TrackListener
-
Field Summary
Fields inherited from class javax.swing.plaf.basic.BasicSliderUI
MAX_SCROLL, MIN_SCROLL, NEGATIVE_SCROLL, POSITIVE_SCROLL
-
Constructor Summary
ConstructorDescriptionConstructs a RangeSliderUI for the specified slider component. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Installs this UI delegate on the specified component.boolean
boolean
void
paint
(Graphics g, JComponent c) Paints the slider.void
Overrides superclass method to do nothing.void
Paints the track.void
scrollByBlock
(int direction) Moves the selected thumb in the specified direction by a block increment.void
scrollByUnit
(int direction) Moves the selected thumb in the specified direction by a unit increment.void
setRangeSliderColour
(Color rangeColor) void
setTrackDragging
(boolean trackDragging) void
setUpperDragging
(boolean upperDragging) void
setUpperThumbFill
(Color upperThumbFill) void
setUpperThumbOutline
(Color upperThumbOutline) void
setUpperThumbRect
(Rectangle upperThumbRect) void
setUpperThumbSelected
(boolean upperThumbSelected) Methods inherited from class PamView.sliders.PamSliderUI
paintThumb, setThumbSizes
Methods inherited from class javax.swing.plaf.basic.BasicSliderUI
createUI, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumHorizontalSize, getMinimumSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredSize, getPreferredVerticalSize, paintFocus, paintLabels, paintTicks, setThumbLocation, uninstallUI, valueForXPosition, valueForYPosition
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
Constructor Details
-
PamRangeSliderUI
Constructs a RangeSliderUI for the specified slider component.- Parameters:
b
- RangeSlider
-
-
Method Details
-
installUI
Installs this UI delegate on the specified component.- Overrides:
installUI
in classBasicSliderUI
-
paint
Paints the slider. The selected thumb is always painted on top of the other thumb.- Overrides:
paint
in classPamSliderUI
-
paintTrack
Paints the track.- Overrides:
paintTrack
in classBasicSliderUI
-
paintThumb
Overrides superclass method to do nothing. Thumb painting is handled within thepaint()
method.- Overrides:
paintThumb
in classPamSliderUI
-
scrollByBlock
public void scrollByBlock(int direction) Moves the selected thumb in the specified direction by a block increment. This method is called when the user presses the Page Up or Down keys.- Overrides:
scrollByBlock
in classBasicSliderUI
-
scrollByUnit
public void scrollByUnit(int direction) Moves the selected thumb in the specified direction by a unit increment. This method is called when the user presses one of the arrow keys.- Overrides:
scrollByUnit
in classBasicSliderUI
-
getUpperThumbRect
-
setUpperThumbRect
-
getRangeSliderColour
-
setRangeSliderColour
-
getUpperThumbFill
-
getUpperThumbOutline
-
isUpperThumbSelected
public boolean isUpperThumbSelected() -
isUpperDragging
public boolean isUpperDragging() -
setUpperThumbFill
-
setUpperThumbOutline
-
setUpperThumbSelected
public void setUpperThumbSelected(boolean upperThumbSelected) -
setUpperDragging
public void setUpperDragging(boolean upperDragging) -
setTrackDragging
public void setTrackDragging(boolean trackDragging)
-