Package snap.view

Class Slider

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
ColorPanel.GradSlider

public class Slider extends View
A Slider control.
  • Field Details

  • Constructor Details

    • Slider

      public Slider()
      Creates a new Slider.
  • Method Details

    • getValue

      public double getValue()
      Returns the value.
    • setValue

      public void setValue(double aValue)
      Sets the value.
    • getValueRatio

      public double getValueRatio()
      Returns the value as a number from 0-1, based on where the value is in the range (min=0, max=1).
    • getMin

      public double getMin()
      Returns the minimum.
    • setMin

      public void setMin(double aValue)
      Sets the minimum.
    • getMax

      public double getMax()
      Returns the maximum.
    • setMax

      public void setMax(double aValue)
      Sets the maximum.
    • getPropValue

      public Object getPropValue(String aPropName)
      Returns the value for given key.
      Overrides:
      getPropValue in class View
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Sets the value for given key.
      Overrides:
      setPropValue in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Calculates the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Calculates the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • paintFront

      protected void paintFront(Painter aPntr)
      Override to wrap in Painter and forward.
      Overrides:
      paintFront in class View
    • paintTrack

      protected void paintTrack(Painter aPntr)
      Override to wrap in Painter and forward.
    • paintKnob

      protected void paintKnob(Painter aPntr)
      Override to wrap in Painter and forward.
    • getTrackBounds

      protected Rect getTrackBounds()
      Returns the track rect.
    • getKnobPoint

      protected Point getKnobPoint()
      Returns the knob point.
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Handle Events.
      Overrides:
      processEvent in class View
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class View
    • fromXML

      public Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class View