Class VerticalSlider

All Implemented Interfaces:
IRenderable, Tweenable, MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class VerticalSlider extends Slider

A Slider whose minimum value is at the top and maximum value is at the bottom.

Up/down arrow buttons and keyboard keys move between values using the configured step size.

  • Field Details

    • ARROW_DOWN

      public static final FontIcon ARROW_DOWN
      Icon used by the increment button below the slider.
    • ARROW_UP

      public static final FontIcon ARROW_UP
      Icon used by the decrement button above the slider.
  • Constructor Details

    • VerticalSlider

      public VerticalSlider(double x, double y, double width, double height, float minValue, float maxValue, float stepSize)
      Creates a vertical slider.
      Parameters:
      x - The horizontal screen coordinate.
      y - The vertical screen coordinate.
      width - The component width.
      height - The component height.
      minValue - The value at the top.
      maxValue - The value at the bottom.
      stepSize - The amount changed by one step.
  • Method Details

    • getRelativeSliderLocation

      public Point2D getRelativeSliderLocation()
      Description copied from class: Slider
      Computes the relative location of the slider thumb within the slider for the current value.
      Specified by:
      getRelativeSliderLocation in class Slider
      Returns:
      the relative location of the slider thumb
    • updateSliderDimensions

      protected void updateSliderDimensions()
      Description copied from class: Slider
      Updates the geometry of the slider in response to a change in min/max value or step size.
      Specified by:
      updateSliderDimensions in class Slider
    • renderBar

      protected void renderBar(Graphics2D g)
      Description copied from class: Slider
      Renders the slider bar (track).
      Specified by:
      renderBar in class Slider
      Parameters:
      g - the graphics context to draw to
    • renderTicks

      protected void renderTicks(Graphics2D g)
      Description copied from class: Slider
      Renders the slider tick marks.
      Specified by:
      renderTicks in class Slider
      Parameters:
      g - the graphics context to draw to
    • getRelativeMouseValue

      protected float getRelativeMouseValue()
      Description copied from class: Slider
      Computes a normalized value (typically in [0, 1]) corresponding to the current mouse location relative to the slider.
      Specified by:
      getRelativeMouseValue in class Slider
      Returns:
      the relative mouse value
    • initializeComponents

      protected void initializeComponents()
      Description copied from class: GuiComponent
      Initialize child components.
      Overrides:
      initializeComponents in class GuiComponent
    • shouldIncreaseOnKey

      protected boolean shouldIncreaseOnKey(int keyCode)
      Description copied from class: Slider
      Determines whether the slider value should be increased when the given key is typed.
      Overrides:
      shouldIncreaseOnKey in class Slider
      Parameters:
      keyCode - the typed key code
      Returns:
      true if the value should be increased
    • shouldDecreaseOnKey

      protected boolean shouldDecreaseOnKey(int keyCode)
      Description copied from class: Slider
      Determines whether the slider value should be decreased when the given key is typed.
      Overrides:
      shouldDecreaseOnKey in class Slider
      Parameters:
      keyCode - the typed key code
      Returns:
      true if the value should be decreased