Package com.luciad.gui.swing
Class TLcdRangeSlider
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.luciad.gui.swing.TLcdRangeSlider
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,SwingConstants
A component that lets the user graphically select a range by sliding a minimum and maximum knob within
a bounded interval.
The slider can display major tick marks, minor tick marks and labels. The range in between the knobs can be
displayed too.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChangeEventOnly one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property.protected doubleThe number of values the knobs move by when they are moved using the keyboard.protected Dictionaryprotected doubleThe number of values between the major tick marks -- the larger marks that break up the minor tick marks.protected doubleThe number of values between the minor tick marks -- the smaller marks that occur between the major tick marks.protected intprotected TLcdRangeSliderModelThe data that handles the numeric maximum value, minimum value, and current-position value for the slider.protected booleanIf true, the labels are drawn.protected booleanIf true, the major ticks are drawn.protected booleanIf true, the minor ticks are drawn.protected booleanIf true, the range is drawn.protected booleanIf true, the cursor changes to a move cursor when held over the range between the minimum and maximum knob.protected booleanIf true, the knobs (and the data range they represents) resolve to the closest tick mark next to where the user positioned the knobs.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
ConstructorsConstructorDescriptionTLcdRangeSlider(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". -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ChangeListener aChangeListener) Adds a listener that will be notified of changes of the model.createStandardLabels(double aIncrement) Creates a hashtable that will draw text labels starting at the slider minimum using the aIncrement specified.createStandardLabels(double aIncrement, double aStart) Creates a hashtable that will draw text labels starting at the aStart point specified using the aIncrement specified.booleanTells is the cursor changes to a move cursor when held over the range between the minimum and maximum knob.doubleReturns the number of values the knobs move by when they are moved using the keyboard.doubleGets the amount of data values between major ticks.doubleReturns the models range maximum value.doubleReturns the models minimum value.doubleGets the range of data values between minor ticks.getModel()Returns the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.intReturns how this slider should be rendered.booleanTells if labels are to be painted.booleanTells if major tick marks are to be painted.booleanTells if minor tick marks are to be painted.booleanTells if the range between the minimum and maximum knobs is to be painted.booleanTells if either the major or minor (or both) tick marks are to be painted.intReturns the number of digits after the decimal point to which the data values are rounded.doubleReturns the models range maximum value.doubleReturns the models range minimum value.booleanReturns true if the knobs (and the range they represent) resolve to the closest tick mark next to where the user positioned the knobs.booleanReturns true if one or both of the slider knobs are being dragged.voidremoveChangeListener(ChangeListener aChangeListener) Removes a listener that will be notified of changes of the model.voidreset()Sets the minimum and maximum knob to the models minimum and maximum.voidsetChangeCursorOverRange(boolean aChangeCursorOverRange) Determines whether the cursor changes to a move cursor when held over the range between the minimum and maximum knob.voidsetEnabled(boolean enabled) voidsetKeyStep(double aKeyStep) Sets the number of values the knobs move by when they are moved using the keyboard.voidsetLabelTable(Dictionary labels) voidsetMajorTickSpacing(double aMajorTickSpacing) Sets the spacing between major ticks.voidsetMaximum(double aMaximum) Sets the models maximum value.voidsetMinimum(double aMinimum) Sets the models minimum value.voidsetMinorTickSpacing(double aMinorTickSpacing) Sets the spacing between minor ticks.voidsetModel(TLcdRangeSliderModel aRangeSliderModel) Sets the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.voidsetOrientation(int aOrientation) Sets how the slider should be rendered, vertically or horizontally.voidsetPaintLabels(boolean aPaintLabels) Tells if labels are to be painted.voidsetPaintMajorTicks(boolean aPaintMajorTicks) Determines whether major tick marks are painted on the slider.voidsetPaintMinorTicks(boolean aPaintMinorTicks) Determines whether minor tick marks are painted on the slider.voidsetPaintTicks(boolean aPaintTicks) Determines whether tick marks (both major and minor) are painted on the slider.voidsetPrecision(int aPrecision) Determines the number of digits after the decimal point.voidsetRange(double aMin, double aMax) Sets the models range minimum and maximum value.voidsetRangeMaximum(double aRangeMaximum) Sets the models range maximum value.voidsetRangeMinimum(double aRangeMinimum) Sets the models range minimum value.voidsetRangeVisble(boolean aRangeVisible) Determines whether the range is painted on the slidervoidsetSnapToTicks(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.voidsetValueIsAdjusting(boolean aValueIsAdjusting) Sets whether the model should anticipate on subsequent changes.protected voidResets the UI property to a value from the current look and feel.voidupdateUI()Methods inherited from class javax.swing.JComponent
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, getUI, 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, updateMethods inherited from class java.awt.Container
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, validateTreeMethods inherited from class java.awt.Component
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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
fRangeSliderModel
The data that handles the numeric maximum value, minimum value, and current-position value for the slider. -
fChangeEvent
Only one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property. -
fSlideCursorFlag
protected boolean fSlideCursorFlagIf true, the cursor changes to a move cursor when held over the range between the minimum and maximum knob. -
fShowMajorTicks
protected boolean fShowMajorTicksIf true, the major ticks are drawn. -
fShowMinorTicks
protected boolean fShowMinorTicksIf true, the minor ticks are drawn. -
fShowRange
protected boolean fShowRangeIf true, the range is drawn. -
fShowLabels
protected boolean fShowLabelsIf true, the labels are drawn. -
fMajorTickSpacing
protected double fMajorTickSpacingThe number of values between the major tick marks -- the larger marks that break up the minor tick marks. -
fMinorTickSpacing
protected double fMinorTickSpacingThe number of values between the minor tick marks -- the smaller marks that occur between the major tick marks. -
fSnapToTicks
protected boolean fSnapToTicksIf true, the knobs (and the data range they represents) resolve to the closest tick mark next to where the user positioned the knobs. -
fOrientation
protected int fOrientation -
fKeyStep
protected double fKeyStepThe number of values the knobs move by when they are moved using the keyboard. -
fLabelTable
-
-
Constructor Details
-
TLcdRangeSlider
public TLcdRangeSlider(double aMin, double aMax) Constructor, takes only a minimum and maximum, all possible options are set to true, except "snap to ticks". The default orientation HORIZONTAL is used.- Parameters:
aMin- Description of ParameteraMax- Description of Parameter
-
TLcdRangeSlider
public 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".- Parameters:
aMin- the sliders minimum.aMax- the sliders maximum.aOrientation- Description of Parameter
-
-
Method Details
-
setModel
Sets the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.- Parameters:
aRangeSliderModel- contains the properties of the slider: minimum, maximum, range minimum and range maximum.
-
setRangeVisble
public void setRangeVisble(boolean aRangeVisible) Determines whether the range is painted on the slider- Parameters:
aRangeVisible- true to render the range on the slider.
-
setMajorTickSpacing
public void setMajorTickSpacing(double aMajorTickSpacing) Sets the spacing between major ticks. This spacing is the amount of values between major ticks.- Parameters:
aMajorTickSpacing- the spacing between major ticks.
-
setMinorTickSpacing
public void setMinorTickSpacing(double aMinorTickSpacing) Sets the spacing between minor ticks. This spacing is the amount of values between minor ticks.- Parameters:
aMinorTickSpacing- the spacing in data values between minor ticks.- See Also:
-
getModel
Returns the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.- Returns:
- the model that handles the sliders fundamental properties: minimum, maximum, range minimum and range maximum.
-
getOrientation
public int getOrientation()Returns how this slider should be rendered.- Returns:
- either VERTICAL or HORIZONTAL.
-
setOrientation
public void setOrientation(int aOrientation) Sets how the slider should be rendered, vertically or horizontally.- Parameters:
aOrientation- sliders orientation, either VERTICAL or HORIZONTAL.
-
getSnapToTicks
public 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.- Returns:
- true to let the knobs snap to the closest tick mark.
-
setSnapToTicks
public 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.- Parameters:
aSnapToTicks- true to make knobs (and the range they represent) snap to the closest tick mark.
-
getPaintMajorTicks
public boolean getPaintMajorTicks()Tells if major tick marks are to be painted.- Returns:
- true to have the major tick marks painted, false otherwise.
-
getPaintMinorTicks
public boolean getPaintMinorTicks()Tells if minor tick marks are to be painted.- Returns:
- true to have the minor tick marks painted, false otherwise.
-
getPaintRange
public boolean getPaintRange()Tells if the range between the minimum and maximum knobs is to be painted.- Returns:
- true to have the range between the minimum and maximum nob rendered.
falseotherwise.
-
getPaintTicks
public boolean getPaintTicks()Tells if either the major or minor (or both) tick marks are to be painted.- Returns:
- true when either minor of major ticks will be rendered, false otherwise.
-
setPaintTicks
public void setPaintTicks(boolean aPaintTicks) Determines whether tick marks (both major and minor) are painted on the slider.- Parameters:
aPaintTicks- true to render all ticks, major and minor, false to render no ticks at all.
-
setPaintMinorTicks
public void setPaintMinorTicks(boolean aPaintMinorTicks) Determines whether minor tick marks are painted on the slider.- Parameters:
aPaintMinorTicks- true to render minor ticks.
-
setPaintMajorTicks
public void setPaintMajorTicks(boolean aPaintMajorTicks) Determines whether major tick marks are painted on the slider.- Parameters:
aPaintMajorTicks- true to render major ticks.
-
setPaintLabels
public void setPaintLabels(boolean aPaintLabels) Tells if labels are to be painted. Note that the label table should also be set.- Parameters:
aPaintLabels- true if the labels should be painted, false otherwise.- See Also:
-
getPaintLabels
public boolean getPaintLabels()Tells if labels are to be painted.- Returns:
- true if the labels should be rendered.
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabledin classJComponent
-
getChangeCursorOverRange
public boolean getChangeCursorOverRange()Tells is the cursor changes to a move cursor when held over the range between the minimum and maximum knob.- Returns:
- true to have the cursor change over the range, false otherwise.
-
setChangeCursorOverRange
public void setChangeCursorOverRange(boolean aChangeCursorOverRange) Determines whether the cursor changes to a move cursor when held over the range between the minimum and maximum knob.- Parameters:
aChangeCursorOverRange- true to make the cursor change when held over the range between the minimum and maximum knob.
-
getMinorTickSpacing
public double getMinorTickSpacing()Gets the range of data values between minor ticks.- Returns:
- the range of data values between minor ticks.
-
getMajorTickSpacing
public double getMajorTickSpacing()Gets the amount of data values between major ticks.- Returns:
- the range of data values between minor ticks.
-
getPrecision
public int getPrecision()Returns the number of digits after the decimal point to which the data values are rounded.- Returns:
- the number of digits after the decimal point to which the data values are rounded.
-
setPrecision
public void setPrecision(int aPrecision) Determines the number of digits after the decimal point. Data values are rounded to this precision.- Parameters:
aPrecision- the number of digits after the decimal point that are to be kept.
-
getValueIsAdjusting
public boolean getValueIsAdjusting()Returns true if one or both of the slider knobs are being dragged.- Returns:
- the value of the models valueIsAdjusting property
-
setValueIsAdjusting
public void setValueIsAdjusting(boolean aValueIsAdjusting) Sets whether the model should anticipate on subsequent changes.- Parameters:
aValueIsAdjusting- true if the model will change frequently subsequently.falseotherwise.
-
reset
public void reset()Sets the minimum and maximum knob to the models minimum and maximum. -
setRangeMinimum
public void setRangeMinimum(double aRangeMinimum) Sets the models range minimum value.- Parameters:
aRangeMinimum- the minimum of the range this slider should cover.
-
setRangeMaximum
public void setRangeMaximum(double aRangeMaximum) Sets the models range maximum value.- Parameters:
aRangeMaximum- the maximum of the range this slider should cover.
-
setMinimum
public void setMinimum(double aMinimum) Sets the models minimum value.- Parameters:
aMinimum- the minimum the range slider can cover.
-
setMaximum
public void setMaximum(double aMaximum) Sets the models maximum value.- Parameters:
aMaximum- the maximum the range slider can cover.
-
setRange
public void setRange(double aMin, double aMax) Sets the models range minimum and maximum value.- Parameters:
aMin- the new minimum of the range.aMax- the new maximum of the range.
-
getRangeMinimum
public double getRangeMinimum()Returns the models range minimum value.- Returns:
- the minimum value of the current range.
-
getRangeMaximum
public double getRangeMaximum()Returns the models range maximum value.- Returns:
- the maximum value of the current range.
-
getMinimum
public double getMinimum()Returns the models minimum value.- Returns:
- the minimum value the range slider can take into account.
-
getMaximum
public double getMaximum()Returns the models range maximum value.- Returns:
- the maximum value the range slider can take into account.
-
addChangeListener
Adds a listener that will be notified of changes of the model.- Parameters:
aChangeListener- a listener that should be notified of changes in the model.
-
removeChangeListener
Removes a listener that will be notified of changes of the model.- Parameters:
aChangeListener- a listener that should no longer be notified of changes in the model.
-
getKeyStep
public double getKeyStep()Returns the number of values the knobs move by when they are moved using the keyboard.- Returns:
- the number of values the knobs move by when they are moved using the keyboard.
-
setKeyStep
public void setKeyStep(double aKeyStep) Sets the number of values the knobs move by when they are moved using the keyboard.- Parameters:
aKeyStep- the number of values the knobs move by when they are moved using the keyboard.
-
getLabelTable
-
setLabelTable
-
updateLabelUIs
protected void updateLabelUIs()Resets the UI property to a value from the current look and feel.- See Also:
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
createStandardLabels
Creates a hashtable that will draw text labels starting at the slider minimum using the aIncrement specified. If you callcreateStandardLabels( 10 )and the slider minimum is zero, then it will make labels for the values 0, 10, 20, 30, and so on.- Parameters:
aIncrement- the step in data space between 2 values for which a label is created.- Returns:
- a hashtable that can be used as label table for this range slider, with the first label assigned to the minimum of the slider and all subsequent labels at a distance apart equal to the increment.
- See Also:
-
createStandardLabels
Creates a hashtable that will draw text labels starting at the aStart point specified using the aIncrement specified. If you callcreateStandardLabels( 10, 2 ), then it will make labels for the values 2, 12, 22, 32, and so on.- Parameters:
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.- Returns:
- a hashtable that can be used as label table for this range slider, with the first label assigned to the aStart value passed and all subsequent labels at a distance apart equal to the aIncrement.
- Throws:
IllegalArgumentException- if slider label aStart point out of range or if label aIncrement is less than or equal to zero- See Also:
-