Package totalcross.ui

Class Slider

  • All Implemented Interfaces:
    ControlAnimation.AnimationFinished, PathAnimation.SetPosition

    public class Slider
    extends ScrollBar
    Slider is a simple slider. You can set some properties of the slider, like drawTicks, invertDirection and drawFilledArea; read the javadocs of each for more information. You can change the thumb size by setting the minDragBarSize public field and then call setValues or setMaximum or setMinimum method (value must always be ODD!).
    Since:
    TotalCross 1.0
    • Field Detail

      • invertDirection

        public boolean invertDirection
        Inverts the direction of the marker. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time. For material UI, inverts the color area.
      • drawTicks

        public boolean drawTicks
        Set to true to draw the ticks. Should be set only when maximum-minimum is much smaller than width. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time.
      • drawFilledArea

        public boolean drawFilledArea
        Set to false to don't draw the filled area. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time.
      • sliderColor

        public int sliderColor
        The color of the slider
      • circleColor

        public int circleColor
        The color of the circle you drag to change the slider value.
      • ticksColor

        public int ticksColor
        The color of the slider ticks
      • barHeight

        public int barHeight
        Size of the bar when it is using MaterialUI
    • Constructor Detail

      • Slider

        public Slider()
        Constructs a HORIZONTAL Slider.
    • Method Detail

      • recomputeParams

        protected void recomputeParams​(boolean justValue)
        Overrides:
        recomputeParams in class ScrollBar
      • onColorsChanged

        public void onColorsChanged​(boolean b)
        Description copied from class: Control
        Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
        Overrides:
        onColorsChanged in class ScrollBar
      • onFontChanged

        public void onFontChanged()
        Description copied from class: Control
        Called after a setFont
        Overrides:
        onFontChanged in class ScrollBar
      • getDragBarPos

        public int getDragBarPos​(int value)
        Returns the drag bar position.
      • onPaint

        public void onPaint​(Graphics g)
        Description copied from class: Container
        Draws the border (if any). If you override this method, be sure to call super.onPaint(g);, or the border will not be drawn.
        Overrides:
        onPaint in class ScrollBar
        Parameters:
        g - the graphics object for drawing
        See Also:
        Graphics
      • getPreferredWidth

        public int getPreferredWidth()
        Description copied from class: ScrollBar
        If this is a vertical scroll bar, i strongly suggest you use PREFERRED in your control's width (with small adjustments).
        Overrides:
        getPreferredWidth in class ScrollBar
      • getPreferredHeight

        public int getPreferredHeight()
        Description copied from class: ScrollBar
        If this is a horizontal scroll bar, i strongly suggest you use PREFERRED in your control's height (with small adjustments)
        Overrides:
        getPreferredHeight in class ScrollBar