Class ScrollBar

java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.ScrollBar
All Implemented Interfaces:
Serializable

public class ScrollBar extends Component
An implementation of a scrollbar.
See Also:
  • Field Details

  • Constructor Details

    • ScrollBar

      public ScrollBar()
      Default constructor. Used to create component instance without any parameters.

      Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.

    • ScrollBar

      public ScrollBar(float x, float y, float width, float height)
      Constructor with position and size parameters.
      Parameters:
      x - x position position in parent component.
      y - y position position in parent component.
      width - width of component.
      height - height of component.
    • ScrollBar

      public ScrollBar(org.joml.Vector2f position, org.joml.Vector2f size)
      Constructor with position and size parameters.
      Parameters:
      position - position position in parent component.
      size - size of component.
    • ScrollBar

      public ScrollBar(float curValue)
      Default constructor with current value parameter.

      Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.

      Parameters:
      curValue - current scroll bar value to set.
    • ScrollBar

      public ScrollBar(float x, float y, float width, float height, float curValue)
      Constructor with position, size and current value parameters.
      Parameters:
      x - x position position in parent component.
      y - y position position in parent component.
      width - width of component.
      height - height of component.
      curValue - current scroll bar value to set.
    • ScrollBar

      public ScrollBar(org.joml.Vector2f position, org.joml.Vector2f size, float curValue)
      Constructor with position, size and current value parameters.
      Parameters:
      position - position position in parent component.
      size - size of component.
      curValue - current scroll bar value to set.
  • Method Details

    • isScrolling

      public boolean isScrolling()
      Determines if scroll bar currently scrolling by user. Used by event listeners.
      Returns:
      true if scrolling.
    • setScrolling

      public void setScrolling(boolean scrolling)
      Used to set scrolling status. By default used by event listeners which implement scrolling behaviour.
      Parameters:
      scrolling - new status to set.
    • getViewport

      public Viewport getViewport()
      Returns viewport if scrollbar attached to viewport.
      Returns:
      scrollbar viewport.
    • setViewport

      public void setViewport(Viewport viewport)
      Used to attach scrollbar to viewport.
      Parameters:
      viewport - viewport to set.
    • getOrientation

      public Orientation getOrientation()
      Returns scrollbar orientation.
      Returns:
      scrollbar orientation.
    • setOrientation

      public void setOrientation(Orientation orientation)
      Used to set scrollbar orientation.
      Parameters:
      orientation - scrollbar orientation to set.
    • getArrowSize

      public float getArrowSize()
      Returns arrow size.
      Returns:
      arrow size.
    • setArrowSize

      public void setArrowSize(float arrowSize)
      Used to set arrow size.
      Parameters:
      arrowSize - arrow size to set.
    • isArrowsEnabled

      public boolean isArrowsEnabled()
      Returns true if arrows enabled.
      Returns:
      true if arrows enabled.
    • setArrowsEnabled

      public void setArrowsEnabled(boolean arrowsEnabled)
      Used to enable/disable arrows.
      Parameters:
      arrowsEnabled - value to enable/disable arrows.
    • getScrollColor

      public org.joml.Vector4f getScrollColor()
      Returns scrollbar color.
      Returns:
      scrollbar color.
    • setScrollColor

      public void setScrollColor(org.joml.Vector4f scrollColor)
      Used to set scrollbar color.
      Parameters:
      scrollColor - scrollbar color to set.
    • getArrowColor

      public org.joml.Vector4f getArrowColor()
      Returns scrollbar arrow color.
      Returns:
      scrollbar arrow color.
    • setArrowColor

      public void setArrowColor(org.joml.Vector4f arrowColor)
      Used to set scrollbar arrow color.
      Parameters:
      arrowColor - scrollbar arrow color to set.
    • getVisibleAmount

      public float getVisibleAmount()
      Returns visible amount (if visible whole scrollbar visible amount = maxValue - minValue)
      Returns:
      visible amount.
    • setVisibleAmount

      public void setVisibleAmount(float visibleAmount)
      By default used by event listeners to set visible part of viewport.
      Parameters:
      visibleAmount - visible size of viewport.
    • getMinValue

      public float getMinValue()
      Returns minimum state of scrollbar.
      Returns:
      minimum state of scrollbar.
    • setMinValue

      public void setMinValue(float minValue)
      Used to set minimum state of scrollbar.
      Parameters:
      minValue - minimum state of scrollbar to set.
    • getMaxValue

      public float getMaxValue()
      Returns maximum state of scrollbar.
      Returns:
      maximum state of scrollbar.
    • setMaxValue

      public void setMaxValue(float maxValue)
      Used to set maximum state of scrollbar.
      Parameters:
      maxValue - maximum state of scrollbar to set.
    • getCurValue

      public float getCurValue()
      Returns current state of scrollbar.
      Returns:
      current state of scrollbar.
    • setCurValue

      public void setCurValue(float curValue)
      Used to set current state of scrollbar.
      Parameters:
      curValue - current state of scrollbar to set.
    • getScrollStep

      public float getScrollStep()
      Returns scrollbar scroll step (used by mouse scroll event listener).
      Returns:
      scrollbar scroll step (used by mouse scroll event listener).
    • setScrollStep

      public void setScrollStep(float scrollStep)
      Used to set scrollbar scroll step (used by mouse scroll event listener).
      Parameters:
      scrollStep - scrollbar scroll step to set.
    • addScrollBarChangeValueEventListener

      public void addScrollBarChangeValueEventListener(EventListener<ScrollBarChangeValueEvent> eventListener)
      Used to add event listener for scroll bar change value event.
      Parameters:
      eventListener - event listener to add.
    • getScrollBarChangeValueEvents

      public List<EventListener<ScrollBarChangeValueEvent>> getScrollBarChangeValueEvents()
      Returns all event listeners for scroll bar change value event.
      Returns:
      all event listeners for scroll bar change value event.
    • removeScrollBarChangeValueEventListener

      public void removeScrollBarChangeValueEventListener(EventListener<ScrollBarChangeValueEvent> eventListener)
      Used to remove event listener for scroll bar change value event.
      Parameters:
      eventListener - event listener to remove.
    • getAnimation

      public Animation getAnimation()
      Returns ScrollBarAnimation.
      Returns:
      scroll bar animation.
    • setAnimation

      public void setAnimation(Animation animation)
      Used to set scroll bar animation. Automatically starts animation.
      Parameters:
      animation - scroll bar animation to set.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Component
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Component
    • toString

      public String toString()
      Overrides:
      toString in class Component