guicomponents

## Class GSlider

- java.lang.Object
- - guicomponents.GComponent
  - - guicomponents.GSlider

- All Implemented Interfaces:
    GConstants, Comparable<Object>, PConstants
  Direct Known Subclasses:
    GHorzSlider, GVertSlider, GWSlider

      public abstract class GSlider
      extends GComponent

  Abstract class to provide a slider - GHorzSlider and GVertSlider inherit from this class.
  Author:
    Peter Lager

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class guicomponents.GComponent

      `GComponent.Z_Order`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DECIMAL`
    `static int` | `EXPONENT`
    `static int` | `INTEGER`

    - ### Fields inherited from class guicomponents.GComponent

      `eventType, fGlobalFont, globalColor, globalColorScheme, globalFont, localColor, localFont, tag, tagNo, z`

    - ### Fields inherited from interface processing.core.PConstants

      `ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_2D, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_STROKE_PERSPECTIVE, DISABLE_TEXTURE_CACHE, DISABLE_TEXTURE_MIPMAPS, DISABLE_TRANSFORM_CACHE, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ACCURATE_2D, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_STROKE_PERSPECTIVE, ENABLE_TEXTURE_CACHE, ENABLE_TEXTURE_MIPMAPS, ENABLE_TRANSFORM_CACHE, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z`

    - ### Fields inherited from interface guicomponents.GConstants

      `ADD_DUPLICATE, BACKGROUND, CHANGED, CLICKED, CLOSE_WINDOW, COLLAPSED, CTRL_ANGULAR, CTRL_HORIZONTAL, CTRL_VERTICAL, DESELECTED, DISABLE_AUTO_DRAW, DRAGGED, ENTERED, EXCP_IN_HANDLER, EXIT_APP, EXPANDED, FAMILY, FOREGROUND, HUD_UNSUPPORTED, INVALID_STATUS, JUSTIFICATION, JUSTIFICATION_FULL, JUSTIFICATION_NONE, KEEP_OPEN, MISSING, NONEXISTANT, NOT_PEASYCAM, POSTURE, POSTURE_OBLIQUE, POSTURE_REGULAR, PRESSED, RELEASED, RUNTIME_ERROR, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLLBAR_HORIZONTAL, SCROLLBAR_VERTICAL, SCROLLBARS_AUTOHIDE, SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY, SELECTED, SET, SIZE, STRIKETHROUGH, STRIKETHROUGH_OFF, STRIKETHROUGH_ON, SUPERSCRIPT, SUPERSCRIPT_SUB, SUPERSCRIPT_SUPER, USER_COL_SCHEME, WEIGHT, WEIGHT_BOLD, WEIGHT_DEMIBOLD, WEIGHT_DEMILIGHT, WEIGHT_EXTRA_LIGHT, WEIGHT_EXTRABOLD, WEIGHT_HEAVY, WEIGHT_LIGHT, WEIGHT_MEDIUM, WEIGHT_REGULAR, WEIGHT_SEMIBOLD, WEIGHT_ULTRABOLD, WIDTH, WIDTH_CONDENSED, WIDTH_EXTENDED, WIDTH_REGULAR, WIDTH_SEMI_CONDENSED, WIDTH_SEMI_EXTENDED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GSlider(PApplet theApplet, int x, int y)`
    `GSlider(PApplet theApplet, int x, int y, int width, int height)` Called by GHorzSlider and GVertSlider.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw()` Override in child classes
    `int` | `getMaxValue()` Get the maximum slider value
    `int` | `getMinValue()` Get the minimum slider value
    `int` | `getValue()` Get the current value represented by the slider
    `float` | `getValuef()` Gets the current value of the slider.
    `int` | `getValueType()` Get the type used for the slider value
    `boolean` | `isOver(int ax, int ay)` Override in child classes
    `boolean` | `isValueChanging()` Is the value changing as a result of the slider thumb being dragged with the mouse.
    `void` | `mouseEvent(MouseEvent event)` Override in child classes
    `void` | `pre()` Move thumb if not at desired position
    `void` | `setInertia(int inertia)` When dragging the slider thumb rapidly with the mouse a certain amount of inertia will give a nice visual effect by trailing the thumb behind the mouse.
    `void` | `setLimits(float init, float min, float max)` Sets the limits of the slider as float values.
    `void` | `setLimits(int init, int min, int max)` The user can change the range and initial value of the slider from the default values of range 0-100 and initial value of 50.
    `void` | `setValue(float newValue)` Sets the target value of the slider, if setInertia(x) has been to implement inertia then the actual slider value will gradually change until it reaches the target value.
    `void` | `setValue(float newValue, boolean ignoreInteria)` The same as setValue(newValue) except the second parameter determines whether we should ignore any inertia value so the affect is immediate.
    `void` | `setValue(int newValue)` Sets the target value of the slider, if setInertia(x) has been used to implement inertia then the actual slider value will gradually change until it reaches the target value.
    `void` | `setValue(int newValue, boolean ignoreInteria)` The same as setValue(newValue) except the second parameter determines whether we should ignore any inertia value so the affect is immediate.
    `void` | `setValueType(int type)` Sets the type of slider that this should be.

    - ### Methods inherited from class guicomponents.GComponent

      `add, addAbsoluteControl, addCompoundControl, addEventHandler, addEventHandler, addRelativeControl, addXXX, calcAbsPosition, changeWindow, compareTo, contains, ctrlMode, dispose, getAlpha, getBorder, getCtrlMode, getEventType, getFocusObject, getHeight, getOpaque, getPApplet, getParent, getStyledText, getText, getTransform, getWidth, getX, getY, hasFocus, hasKeyFocus, isEnabled, isVisible, keyPressed, remove, setAlpha, setBorder, setColorScheme, setEnabled, setFocus, setFont, setFontNew, setFontNew, setHeight, setLocalColorScheme, setOpaque, setRotation, setText, setText, setTextAlign, setTextNew, setTextNew, setVisible, setWidth, setX, setXY, setY, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### INTEGER

          public static final int INTEGER

      See Also:
        Constant Field Values

    - #### DECIMAL

          public static final int DECIMAL

      See Also:
        Constant Field Values

    - #### EXPONENT

          public static final int EXPONENT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GSlider

          public GSlider(PApplet theApplet,
                 int x,
                 int y,
                 int width,
                 int height)

      Called by GHorzSlider and GVertSlider.
      Parameters:
        `theApplet` -
        `x` -
        `y` -
        `width` -
        `height` -

    - #### GSlider

          public GSlider(PApplet theApplet,
                 int x,
                 int y)

  - ### Method Detail

    - #### setLimits

          public void setLimits(int init,
                       int min,
                       int max)

      The user can change the range and initial value of the slider from the default values of range 0-100 and initial value of 50. This method ignores inertia so the effect is immediate.
      Parameters:
        `init` -
        `min` -
        `max` -

    - #### setLimits

          public void setLimits(float init,
                       float min,
                       float max)

      Sets the limits of the slider as float values. Converted to floats or integer depending on the type of the slider.

    - #### mouseEvent

          public void mouseEvent(MouseEvent event)

      Override in child classes
      Overrides:
        `mouseEvent` in class `GComponent`

    - #### isOver

          public boolean isOver(int ax,
                       int ay)

      Override in child classes
      Overrides:
        `isOver` in class `GComponent`
      Parameters:
        `ax` - mouse x position
        `ay` - mouse y position
      Returns:
        always false

    - #### getMinValue

          public int getMinValue()

      Get the minimum slider value
      Returns:
        min value

    - #### getMaxValue

          public int getMaxValue()

      Get the maximum slider value
      Returns:
        max value

    - #### setValueType

          public void setValueType(int type)

      Sets the type of slider that this should be.
      INTEGER or DECIMAL or EXPONENT

    - #### getValueType

          public int getValueType()

      Get the type used for the slider value
      Returns:
        GSlider.INTEGER or GSlider.DECIMAL or GSlider.EXPONENT

    - #### getValue

          public int getValue()

      Get the current value represented by the slider
      Returns:
        current value

    - #### getValuef

          public float getValuef()

      Gets the current value of the slider. If the value type is integer then the value is rounded.

    - #### isValueChanging

          public boolean isValueChanging()

      Is the value changing as a result of the slider thumb being dragged with the mouse.
      Returns:
        true if value being changed at GUI

    - #### setValue

          public void setValue(int newValue)

      Sets the target value of the slider, if setInertia(x) has been used to implement inertia then the actual slider value will gradually change until it reaches the target value. The slider thumb is always in the right position for the current slider value.
      Note that events will continue to be generated so if this causes unexpected behaviour then use setValue(newValue, true)
      Parameters:
        `newValue` - the value we wish the slider to become

    - #### setValue

          public void setValue(int newValue,
                      boolean ignoreInteria)

      The same as setValue(newValue) except the second parameter determines whether we should ignore any inertia value so the affect is immediate.
      Note if false then events will continue to be generated so if this causes unexpected behaviour then use setValue(newValue, true)
      Parameters:
        `newValue` - the value we wish the slider to become
        `ignoreInteria` - if true change is immediate

    - #### setValue

          public void setValue(float newValue)

      Sets the target value of the slider, if setInertia(x) has been to implement inertia then the actual slider value will gradually change until it reaches the target value. The slider thumb is always in the right position for the current slider value.
      Note that events will continue to be generated so if this causes unexpected behaviour then use setValue(newValue, true)
      Parameters:
        `newValue` - the value we wish the slider to become

    - #### setValue

          public void setValue(float newValue,
                      boolean ignoreInteria)

      The same as setValue(newValue) except the second parameter determines whether we should ignore any inertia value so the affect is immediate.
      Note if false then events will continue to be generated so if this causes unexpected behaviour then use setValue(newValue, true)
      Parameters:
        `newValue` - the value we wish the slider to become
        `ignoreInteria` - if true change is immediate

    - #### setInertia

          public void setInertia(int inertia)

      When dragging the slider thumb rapidly with the mouse a certain amount of inertia will give a nice visual effect by trailing the thumb behind the mouse. A value of 1 (default) means the thumb is always in step with the mouse. Increasing values will increase the amount of trailing and the length of time needed to reach the final value. I have found values around 10 give quite nice effect but much over 20 and you start to loose the gliding effect due to acceleration and deacceleration.
      Parameters:
        `inertia` - values passed is constrained to the range 1-50.

    - #### pre

          public void pre()

      Move thumb if not at desired position
      Overrides:
        `pre` in class `GComponent`

    - #### draw

          public void draw()

      Override in child classes
      Overrides:
        `draw` in class `GComponent`

Processing library guicomponents by Peter Lager. (C) 2012