public class RangeSlider extends javax.swing.JSlider
Note that RangeSlider makes use of the default BoundedRangeModel, which supports an inner range defined by a value and an extent. The upper value returned by RangeSlider is simply the lower value plus the extent.
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
RangeSlider()
Creates a horizontal range slider with the range 0 to 100 and
an initial value of 50.
|
RangeSlider(int orientation)
Creates a range slider using the specified orientation with the
range
0 to 100 and an initial value of 50 . |
RangeSlider(int min,
int max)
Creates a horizontal range slider using the specified min and max
with an initial value equal to the average of the min plus max.
|
RangeSlider(int min,
int max,
int low,
int high)
Creates a horizontal range slider using the specified min, max and value.
|
RangeSlider(int orientation,
int min,
int max,
int low,
int high)
Creates a range slider with the specified orientation and the
specified minimum, maximum, initial values and extend.
|
Modifier and Type | Method and Description |
---|---|
int |
getLowerValue()
Returns the lower value in the range.
|
int |
getUpperValue()
Returns the upper value in the range.
|
int |
getValue()
Returns the lower value in the range.
|
void |
setFocusable(boolean focusable) |
void |
setLowerValue(int value)
Sets the lower value in the range.
|
void |
setUpperValue(int value)
Sets the upper value in the range.
|
void |
setValue(int value)
Sets the lower value in the range.
|
void |
updateUI()
Overrides the superclass method to install the UI delegate to draw two
thumbs.
|
addChangeListener, createStandardLabels, createStandardLabels, getAccessibleContext, getChangeListeners, getExtent, getInverted, getLabelTable, getMajorTickSpacing, getMaximum, getMinimum, getMinorTickSpacing, getModel, getOrientation, getPaintLabels, getPaintTicks, getPaintTrack, getSnapToTicks, getUI, getUIClassID, getValueIsAdjusting, imageUpdate, removeChangeListener, setExtent, setFont, setInverted, setLabelTable, setMajorTickSpacing, setMaximum, setMinimum, setMinorTickSpacing, setModel, setOrientation, setPaintLabels, setPaintTicks, setPaintTrack, setSnapToTicks, setUI, setValueIsAdjusting
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public RangeSlider(int orientation, int min, int max, int low, int high)
SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
.
The BoundedRangeModel
that holds the slider's data handles any issues that may
arise from improperly setting the minimum, initial, and maximum values on the slider. See the
BoundedRangeModel
documentation for details.
orientation
- the orientation of the slidermin
- the minimum value of the slidermax
- the maximum value of the sliderlow
- the lower range value of the sliderhigh
- the higher range value of the sliderjava.lang.IllegalArgumentException
- if orientation is not one of VERTICAL
, HORIZONTAL
BoundedRangeModel
,
JSlider.setOrientation(int)
,
JSlider.setMinimum(int)
,
JSlider.setMaximum(int)
,
setLowerValue(int)
,
setUpperValue(int)
public RangeSlider(int min, int max, int low, int high)
The BoundedRangeModel
that holds the slider's data handles any issues that may
arise from improperly setting the minimum, initial, and maximum values on the slider. See the
BoundedRangeModel
documentation for details.
min
- the minimum value of the slidermax
- the maximum value of the sliderlow
- the lower range value of the sliderhigh
- the higher range value of the sliderBoundedRangeModel
,
JSlider.setMinimum(int)
,
JSlider.setMaximum(int)
,
setLowerValue(int)
,
setUpperValue(int)
public RangeSlider(int min, int max)
The BoundedRangeModel
that holds the slider's data handles any issues that may
arise from improperly setting the minimum and maximum values on the slider. See the
BoundedRangeModel
documentation for details.
min
- the minimum value of the slidermax
- the maximum value of the sliderBoundedRangeModel
,
JSlider.setMinimum(int)
,
JSlider.setMaximum(int)
public RangeSlider(int orientation)
0
to 100
and an initial value of 50
.
The orientation can be
either SwingConstants.VERTICAL
or SwingConstants.HORIZONTAL
.orientation
- the orientation of the sliderjava.lang.IllegalArgumentException
- if orientation is not one of VERTICAL
, HORIZONTAL
JSlider.setOrientation(int)
public RangeSlider()
public void setFocusable(boolean focusable)
setFocusable
in class java.awt.Component
public void updateUI()
updateUI
in class javax.swing.JSlider
public int getValue()
getValue
in class javax.swing.JSlider
public void setValue(int value)
setValue
in class javax.swing.JSlider
public int getLowerValue()
public void setLowerValue(int value)
public int getUpperValue()
public void setUpperValue(int value)