Class TLcdRangeSlider

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, SwingConstants

public class TLcdRangeSlider extends JComponent implements 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:
  • Field Details Link icon

    • fRangeSliderModel Link icon

      protected TLcdRangeSliderModel fRangeSliderModel
      The data that handles the numeric maximum value, minimum value, and current-position value for the slider.
    • fChangeEvent Link icon

      protected ChangeEvent fChangeEvent
      Only one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property.
    • fSlideCursorFlag Link icon

      protected boolean fSlideCursorFlag
      If true, the cursor changes to a move cursor when held over the range between the minimum and maximum knob.
    • fShowMajorTicks Link icon

      protected boolean fShowMajorTicks
      If true, the major ticks are drawn.
    • fShowMinorTicks Link icon

      protected boolean fShowMinorTicks
      If true, the minor ticks are drawn.
    • fShowRange Link icon

      protected boolean fShowRange
      If true, the range is drawn.
    • fShowLabels Link icon

      protected boolean fShowLabels
      If true, the labels are drawn.
    • fMajorTickSpacing Link icon

      protected double fMajorTickSpacing
      The number of values between the major tick marks -- the larger marks that break up the minor tick marks.
    • fMinorTickSpacing Link icon

      protected double fMinorTickSpacing
      The number of values between the minor tick marks -- the smaller marks that occur between the major tick marks.
    • fSnapToTicks Link icon

      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.
    • fOrientation Link icon

      protected int fOrientation
    • fKeyStep Link icon

      protected double fKeyStep
      The number of values the knobs move by when they are moved using the keyboard.
    • fLabelTable Link icon

      protected Dictionary fLabelTable
  • Constructor Details Link icon

    • TLcdRangeSlider Link icon

      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 Parameter
      aMax - Description of Parameter
    • TLcdRangeSlider Link icon

      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 Link icon

    • setModel Link icon

      public void setModel(TLcdRangeSliderModel aRangeSliderModel)
      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public TLcdRangeSliderModel 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 Link icon

      public int getOrientation()
      Returns how this slider should be rendered.
      Returns:
      either VERTICAL or HORIZONTAL.
    • setOrientation Link icon

      public void setOrientation(int aOrientation)
      Sets how the slider should be rendered, vertically or horizontally.
      Parameters:
      aOrientation - sliders orientation, either VERTICAL or HORIZONTAL.
    • getSnapToTicks Link icon

      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 Link icon

      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 Link icon

      public boolean getPaintMajorTicks()
      Tells if major tick marks are to be painted.
      Returns:
      true to have the major tick marks painted, false otherwise.
    • getPaintMinorTicks Link icon

      public boolean getPaintMinorTicks()
      Tells if minor tick marks are to be painted.
      Returns:
      true to have the minor tick marks painted, false otherwise.
    • getPaintRange Link icon

      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. false otherwise.
    • getPaintTicks Link icon

      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 Link icon

      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 Link icon

      public void setPaintMinorTicks(boolean aPaintMinorTicks)
      Determines whether minor tick marks are painted on the slider.
      Parameters:
      aPaintMinorTicks - true to render minor ticks.
    • setPaintMajorTicks Link icon

      public void setPaintMajorTicks(boolean aPaintMajorTicks)
      Determines whether major tick marks are painted on the slider.
      Parameters:
      aPaintMajorTicks - true to render major ticks.
    • setPaintLabels Link icon

      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 Link icon

      public boolean getPaintLabels()
      Tells if labels are to be painted.
      Returns:
      true if the labels should be rendered.
    • setEnabled Link icon

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class JComponent
    • getChangeCursorOverRange Link icon

      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 Link icon

      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 Link icon

      public double getMinorTickSpacing()
      Gets the range of data values between minor ticks.
      Returns:
      the range of data values between minor ticks.
    • getMajorTickSpacing Link icon

      public double getMajorTickSpacing()
      Gets the amount of data values between major ticks.
      Returns:
      the range of data values between minor ticks.
    • getPrecision Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public void setValueIsAdjusting(boolean aValueIsAdjusting)
      Sets whether the model should anticipate on subsequent changes.
      Parameters:
      aValueIsAdjusting - true if the model will change frequently subsequently. false otherwise.
    • reset Link icon

      public void reset()
      Sets the minimum and maximum knob to the models minimum and maximum.
    • setRangeMinimum Link icon

      public void setRangeMinimum(double aRangeMinimum)
      Sets the models range minimum value.
      Parameters:
      aRangeMinimum - the minimum of the range this slider should cover.
    • setRangeMaximum Link icon

      public void setRangeMaximum(double aRangeMaximum)
      Sets the models range maximum value.
      Parameters:
      aRangeMaximum - the maximum of the range this slider should cover.
    • setMinimum Link icon

      public void setMinimum(double aMinimum)
      Sets the models minimum value.
      Parameters:
      aMinimum - the minimum the range slider can cover.
    • setMaximum Link icon

      public void setMaximum(double aMaximum)
      Sets the models maximum value.
      Parameters:
      aMaximum - the maximum the range slider can cover.
    • setRange Link icon

      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 Link icon

      public double getRangeMinimum()
      Returns the models range minimum value.
      Returns:
      the minimum value of the current range.
    • getRangeMaximum Link icon

      public double getRangeMaximum()
      Returns the models range maximum value.
      Returns:
      the maximum value of the current range.
    • getMinimum Link icon

      public double getMinimum()
      Returns the models minimum value.
      Returns:
      the minimum value the range slider can take into account.
    • getMaximum Link icon

      public double getMaximum()
      Returns the models range maximum value.
      Returns:
      the maximum value the range slider can take into account.
    • addChangeListener Link icon

      public void addChangeListener(ChangeListener aChangeListener)
      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 Link icon

      public void removeChangeListener(ChangeListener aChangeListener)
      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 Link icon

      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 Link icon

      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 Link icon

      public Dictionary getLabelTable()
    • setLabelTable Link icon

      public void setLabelTable(Dictionary labels)
    • updateLabelUIs Link icon

      protected void updateLabelUIs()
      Resets the UI property to a value from the current look and feel.
      See Also:
    • updateUI Link icon

      public void updateUI()
      Overrides:
      updateUI in class JComponent
    • getUIClassID Link icon

      public String getUIClassID()
      Overrides:
      getUIClassID in class JComponent
    • createStandardLabels Link icon

      public Hashtable createStandardLabels(double aIncrement)
      Creates a hashtable that will draw text labels starting at the slider minimum using the aIncrement specified. If you call createStandardLabels( 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 Link icon

      public Hashtable createStandardLabels(double aIncrement, double aStart)
      Creates a hashtable that will draw text labels starting at the aStart point specified using the aIncrement specified. If you call createStandardLabels( 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: