public class TLcdRangeSlider extends JComponent implements SwingConstants
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected ChangeEvent |
fChangeEvent
Only one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property.
|
protected double |
fKeyStep
The number of values the knobs move by when they are moved using the keyboard.
|
protected Dictionary |
fLabelTable |
protected double |
fMajorTickSpacing
The number of values between the major tick marks -- the larger marks that break up the minor tick marks.
|
protected double |
fMinorTickSpacing
The number of values between the minor tick marks -- the smaller marks that occur between the major tick marks.
|
protected int |
fOrientation |
protected TLcdRangeSliderModel |
fRangeSliderModel
The data that handles the numeric maximum value, minimum value, and current-position value for the slider.
|
protected boolean |
fShowLabels
If true, the labels are drawn.
|
protected boolean |
fShowMajorTicks
If true, the major ticks are drawn.
|
protected boolean |
fShowMinorTicks
If true, the minor ticks are drawn.
|
protected boolean |
fShowRange
If true, the range is drawn.
|
protected boolean |
fSlideCursorFlag
If true, the cursor changes to a move cursor when held over the range between the minimum and maximum knob.
|
protected boolean |
fSnapToTicks
If true, the knobs (and the data range they represents) resolve to the closest tick mark next to where the user positioned the knobs.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TLcdRangeSlider(double aMin,
double aMax)
Constructor, takes only a minimum and maximum, all possible options are
set to true, except "snap to ticks".
|
TLcdRangeSlider(double aMin,
double aMax,
int aOrientation)
Constructor, takes only a minimum maximum and a orientation, all possible
options are set to true, except "snap to ticks".
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener aChangeListener)
Adds a listener that will be notified of changes of the model.
|
Hashtable |
createStandardLabels(double aIncrement)
Creates a hashtable that will draw text labels starting at the
slider minimum using the aIncrement specified.
|
Hashtable |
createStandardLabels(double aIncrement,
double aStart)
Creates a hashtable that will draw text labels starting at the
aStart point
specified using the aIncrement specified.
|
boolean |
getChangeCursorOverRange()
Tells is the cursor changes to a move cursor when held over the range between the minimum and maximum knob.
|
double |
getKeyStep()
Returns the number of values the knobs move by when they are moved using the keyboard.
|
Dictionary |
getLabelTable() |
double |
getMajorTickSpacing()
Gets the amount of data values between major ticks.
|
double |
getMaximum()
Returns the models range maximum value.
|
double |
getMinimum()
Returns the models minimum value.
|
double |
getMinorTickSpacing()
Gets the range of data values between minor ticks.
|
TLcdRangeSliderModel |
getModel()
Returns the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.
|
int |
getOrientation()
Returns how this slider should be rendered.
|
boolean |
getPaintLabels()
Tells if labels are to be painted.
|
boolean |
getPaintMajorTicks()
Tells if major tick marks are to be painted.
|
boolean |
getPaintMinorTicks()
Tells if minor tick marks are to be painted.
|
boolean |
getPaintRange()
Tells if the range between the minimum and maximum knobs is to be painted.
|
boolean |
getPaintTicks()
Tells if either the major or minor (or both) tick marks are to be painted.
|
int |
getPrecision()
Returns the number of digits after the decimal point to which the data values are rounded.
|
double |
getRangeMaximum()
Returns the models range maximum value.
|
double |
getRangeMinimum()
Returns the models range minimum value.
|
boolean |
getSnapToTicks()
Returns true if the knobs (and the range they represent) resolve to the closest tick mark next to where the
user positioned the knobs.
|
String |
getUIClassID() |
boolean |
getValueIsAdjusting()
Returns true if one or both of the slider knobs are being dragged.
|
void |
removeChangeListener(ChangeListener aChangeListener)
Removes a listener that will be notified of changes of the model.
|
void |
reset()
Sets the minimum and maximum knob to the models minimum and maximum.
|
void |
setChangeCursorOverRange(boolean aChangeCursorOverRange)
Determines whether the cursor changes to a move cursor when held over the range between the minimum and maximum knob.
|
void |
setEnabled(boolean enabled) |
void |
setKeyStep(double aKeyStep)
Sets the number of values the knobs move by when they are moved using the keyboard.
|
void |
setLabelTable(Dictionary labels) |
void |
setMajorTickSpacing(double aMajorTickSpacing)
Sets the spacing between major ticks.
|
void |
setMaximum(double aMaximum)
Sets the models maximum value.
|
void |
setMinimum(double aMinimum)
Sets the models minimum value.
|
void |
setMinorTickSpacing(double aMinorTickSpacing)
Sets the spacing between minor ticks.
|
void |
setModel(TLcdRangeSliderModel aRangeSliderModel)
Sets the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.
|
void |
setOrientation(int aOrientation)
Sets how the slider should be rendered, vertically or horizontally.
|
void |
setPaintLabels(boolean aPaintLabels)
Tells if labels are to be painted.
|
void |
setPaintMajorTicks(boolean aPaintMajorTicks)
Determines whether major tick marks are painted on the slider.
|
void |
setPaintMinorTicks(boolean aPaintMinorTicks)
Determines whether minor tick marks are painted on the slider.
|
void |
setPaintTicks(boolean aPaintTicks)
Determines whether tick marks (both major and minor) are painted on the slider.
|
void |
setPrecision(int aPrecision)
Determines the number of digits after the decimal point.
|
void |
setRange(double aMin,
double aMax)
Sets the models range minimum and maximum value.
|
void |
setRangeMaximum(double aRangeMaximum)
Sets the models range maximum value.
|
void |
setRangeMinimum(double aRangeMinimum)
Sets the models range minimum value.
|
void |
setRangeVisble(boolean aRangeVisible)
Determines whether the range is painted on the slider
|
void |
setSnapToTicks(boolean aSnapToTicks)
Specifying true makes the knobs (and the range they represent) resolve to the closest tick mark next to where the
user positioned the knobs.
|
void |
setValueIsAdjusting(boolean aValueIsAdjusting)
Sets whether the model should anticipate on subsequent changes.
|
protected void |
updateLabelUIs()
Resets the UI property to a value from the current look and feel.
|
void |
updateUI() |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, imageUpdate, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected TLcdRangeSliderModel fRangeSliderModel
protected ChangeEvent fChangeEvent
protected boolean fSlideCursorFlag
protected boolean fShowMajorTicks
protected boolean fShowMinorTicks
protected boolean fShowRange
protected boolean fShowLabels
protected double fMajorTickSpacing
protected double fMinorTickSpacing
protected boolean fSnapToTicks
protected int fOrientation
protected double fKeyStep
protected Dictionary fLabelTable
public TLcdRangeSlider(double aMin, double aMax)
aMin
- Description of ParameteraMax
- Description of Parameterpublic TLcdRangeSlider(double aMin, double aMax, int aOrientation)
aMin
- the sliders minimum.aMax
- the sliders maximum.aOrientation
- Description of Parameterpublic void setModel(TLcdRangeSliderModel aRangeSliderModel)
aRangeSliderModel
- contains the properties of the slider: minimum, maximum, range minimum and range maximum.public void setRangeVisble(boolean aRangeVisible)
aRangeVisible
- true to render the range on the slider.public void setMajorTickSpacing(double aMajorTickSpacing)
aMajorTickSpacing
- the spacing between major ticks.public void setMinorTickSpacing(double aMinorTickSpacing)
aMinorTickSpacing
- the spacing in data values between minor ticks.getMinorTickSpacing()
,
setPaintMinorTicks(boolean)
public TLcdRangeSliderModel getModel()
public int getOrientation()
public void setOrientation(int aOrientation)
aOrientation
- sliders orientation, either VERTICAL or HORIZONTAL.public boolean getSnapToTicks()
public void setSnapToTicks(boolean aSnapToTicks)
aSnapToTicks
- true to make knobs (and the range they represent) snap to the closest tick mark.public boolean getPaintMajorTicks()
public boolean getPaintMinorTicks()
public boolean getPaintRange()
false
otherwise.public boolean getPaintTicks()
public void setPaintTicks(boolean aPaintTicks)
aPaintTicks
- true to render all ticks, major and minor, false to render no ticks at all.public void setPaintMinorTicks(boolean aPaintMinorTicks)
aPaintMinorTicks
- true to render minor ticks.public void setPaintMajorTicks(boolean aPaintMajorTicks)
aPaintMajorTicks
- true to render major ticks.public void setPaintLabels(boolean aPaintLabels)
aPaintLabels
- true if the labels should be painted, false otherwise.setLabelTable(java.util.Dictionary)
public boolean getPaintLabels()
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
public boolean getChangeCursorOverRange()
public void setChangeCursorOverRange(boolean aChangeCursorOverRange)
aChangeCursorOverRange
- true to make the cursor change when held over the range between the minimum and maximum knob.public double getMinorTickSpacing()
public double getMajorTickSpacing()
public int getPrecision()
public void setPrecision(int aPrecision)
aPrecision
- the number of digits after the decimal point that are to be kept.public boolean getValueIsAdjusting()
public void setValueIsAdjusting(boolean aValueIsAdjusting)
aValueIsAdjusting
- true if the model will change frequently subsequently. false
otherwise.public void reset()
public void setRangeMinimum(double aRangeMinimum)
aRangeMinimum
- the minimum of the range this slider should cover.public void setRangeMaximum(double aRangeMaximum)
aRangeMaximum
- the maximum of the range this slider should cover.public void setMinimum(double aMinimum)
aMinimum
- the minimum the range slider can cover.public void setMaximum(double aMaximum)
aMaximum
- the maximum the range slider can cover.public void setRange(double aMin, double aMax)
aMin
- the new minimum of the range.aMax
- the new maximum of the range.public double getRangeMinimum()
public double getRangeMaximum()
public double getMinimum()
public double getMaximum()
public void addChangeListener(ChangeListener aChangeListener)
aChangeListener
- a listener that should be notified of changes in the model.public void removeChangeListener(ChangeListener aChangeListener)
aChangeListener
- a listener that should no longer be notified of changes in the model.public double getKeyStep()
public void setKeyStep(double aKeyStep)
aKeyStep
- the number of values the knobs move by when they are moved using the keyboard.public Dictionary getLabelTable()
public void setLabelTable(Dictionary labels)
protected void updateLabelUIs()
JComponent.updateUI()
public void updateUI()
updateUI
in class JComponent
public String getUIClassID()
getUIClassID
in class JComponent
public Hashtable createStandardLabels(double aIncrement)
createStandardLabels( 10 )
and the slider minimum is
zero, then it will make labels for the values 0, 10, 20, 30, and so on.aIncrement
- the step in data space between 2 values for which a label is created.setLabelTable(java.util.Dictionary)
public Hashtable createStandardLabels(double aIncrement, double aStart)
createStandardLabels( 10, 2 )
,
then it will make labels for the values 2, 12, 22, 32, and so on.aIncrement
- the step in data space between 2 values for which a label is created.aStart
- the data value for which the first label should be created.IllegalArgumentException
- if slider label aStart point
out of range or if label aIncrement is less than or equal
to zerosetLabelTable(java.util.Dictionary)