Package com.spinyowl.legui.component
Class ScrollBar
java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.ScrollBar
- All Implemented Interfaces:
Serializable
An implementation of a scrollbar.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ScrollBar(float curValue) Default constructor with current value parameter.ScrollBar(float x, float y, float width, float height) Constructor with position and size parameters.ScrollBar(float x, float y, float width, float height, float curValue) Constructor with position, size and current value parameters.ScrollBar(org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters.ScrollBar(org.joml.Vector2f position, org.joml.Vector2f size, float curValue) Constructor with position, size and current value parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidUsed to add event listener for scroll bar change value event.booleanReturns ScrollBarAnimation.org.joml.Vector4fReturns scrollbar arrow color.floatReturns arrow size.floatReturns current state of scrollbar.floatReturns maximum state of scrollbar.floatReturns minimum state of scrollbar.Returns scrollbar orientation.Returns all event listeners for scroll bar change value event.org.joml.Vector4fReturns scrollbar color.floatReturns scrollbar scroll step (used by mouse scroll event listener).Returns viewport if scrollbar attached to viewport.floatReturns visible amount (if visible whole scrollbar visible amount =maxValue-minValue)inthashCode()booleanReturns true if arrows enabled.booleanDetermines if scroll bar currently scrolling by user.voidUsed to remove event listener for scroll bar change value event.voidsetAnimation(Animation animation) Used to set scroll bar animation.voidsetArrowColor(org.joml.Vector4f arrowColor) Used to set scrollbar arrow color.voidsetArrowsEnabled(boolean arrowsEnabled) Used to enable/disable arrows.voidsetArrowSize(float arrowSize) Used to set arrow size.voidsetCurValue(float curValue) Used to set current state of scrollbar.voidsetMaxValue(float maxValue) Used to set maximum state of scrollbar.voidsetMinValue(float minValue) Used to set minimum state of scrollbar.voidsetOrientation(Orientation orientation) Used to set scrollbar orientation.voidsetScrollColor(org.joml.Vector4f scrollColor) Used to set scrollbar color.voidsetScrolling(boolean scrolling) Used to set scrolling status.voidsetScrollStep(float scrollStep) Used to set scrollbar scroll step (used by mouse scroll event listener).voidsetViewport(Viewport viewport) Used to attach scrollbar to viewport.voidsetVisibleAmount(float visibleAmount) By default used by event listeners to set visible part of viewport.toString()Methods inherited from class com.spinyowl.legui.component.Component
add, add, addAll, clearChildComponents, containerIterator, contains, containsAll, count, forEach, getAbsolutePosition, getChildComponents, getFocusedStyle, getFrame, getHoveredStyle, getIntersector, getLayer, getListenerMap, getMetadata, getParent, getPosition, getPressedStyle, getSize, getStyle, getTabIndex, getTooltip, indexOfChild, intersects, isEmpty, isEnabled, isFocusable, isFocused, isHovered, isPressed, isTabFocusable, isVisible, keepRendering, keepRendering, parallelStream, remove, remove, removeAll, removeIf, setEnabled, setFocusable, setFocused, setHovered, setIntersector, setListenerMap, setParent, setPosition, setPosition, setPressed, setSize, setSize, setStyle, setTabFocusable, setTabIndex, setTooltip, stream
-
Field Details
-
MIN_SCROLL_SIZE
public static final float MIN_SCROLL_SIZE- See Also:
-
-
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
Returns viewport if scrollbar attached to viewport.- Returns:
- scrollbar viewport.
-
setViewport
Used to attach scrollbar to viewport.- Parameters:
viewport- viewport to set.
-
getOrientation
Returns scrollbar orientation.- Returns:
- scrollbar orientation.
-
setOrientation
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
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
Returns ScrollBarAnimation.- Returns:
- scroll bar animation.
-
setAnimation
Used to set scroll bar animation. Automatically starts animation.- Parameters:
animation- scroll bar animation to set.
-
equals
-
hashCode
public int hashCode() -
toString
-