Package com.avrix.ui.widgets
Class ScrollbarWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
com.avrix.ui.widgets.ScrollbarWidget
The
ScrollbarWidget
class represents a scrollbar component that can be either horizontal or vertical.
It extends the PanelWidget
class.-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs aScrollbarWidget
with a default vertical orientation.ScrollbarWidget
(boolean horizontal) Constructs aScrollbarWidget
with the specified orientation. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Gets the border offset of the scrollbar.final int
Gets the compressed width of the scrollbar.final NanoColor
Gets the color of the scrollbar thumb (the draggable part of the scrollbar).void
onLeftMouseDown
(int x, int y) Called when the left mouse button is pressed down over theWidget
.void
onLeftMouseUp
(int x, int y) Called when the left mouse button is released over theWidget
.void
onLeftMouseUpOutside
(int x, int y) Handles the left mouse button up event outside any visibleWidget
void
render()
Renders theWidget
final void
setBorderOffset
(int borderOffset) Sets the border offset of the scrollbar.final void
setCompressedWidth
(int compressedWidth) Sets the compressed width of the scrollbar.final void
setThumbColor
(NanoColor thumbColor) Sets the color of the scrollbar thumb (the draggable part of the scrollbar).void
update()
Updates theWidget
void
Update theWidget
positionMethods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, postRender, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorder
Methods inherited from class com.avrix.ui.widgets.Widget
addChild, addToScreen, bringToTop, drawArc, drawArc, drawCircle, drawEllipse, drawImage, drawLine, drawRect, drawRectOutline, drawRoundedRect, drawRoundedRectOutline, drawText, getAbsoluteParent, getChildren, getHeight, getMaxScrollX, getMaxScrollY, getParent, getScrollSpeed, getScrollX, getScrollY, getWidth, getX, getXA, getY, getYA, intersectScissor, isAlwaysOnTop, isHovered, isPointOver, isScrollable, isScrollLock, isVisible, isVisibleWithinParent, isVisibleWithinWindow, onInitialize, onKeyPress, onKeyRelease, onKeyRepeat, onLeftMouseDownOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, preRender, removeChild, removeFromScreen, renderChildren, setAlwaysOnTop, setHeight, setMaxScrollX, setMaxScrollY, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA
-
Constructor Details
-
ScrollbarWidget
public ScrollbarWidget(boolean horizontal) Constructs aScrollbarWidget
with the specified orientation.- Parameters:
horizontal
-true
if the scrollbar should be horizontal,false
if it should be vertical.
-
ScrollbarWidget
public ScrollbarWidget()Constructs aScrollbarWidget
with a default vertical orientation.
-
-
Method Details
-
getThumbColor
Gets the color of the scrollbar thumb (the draggable part of the scrollbar).- Returns:
- the color of the scrollbar thumb as a
NanoColor
object
-
setThumbColor
Sets the color of the scrollbar thumb (the draggable part of the scrollbar).- Parameters:
thumbColor
- the color to set for the scrollbar thumb, specified as aNanoColor
object
-
getBorderOffset
public final int getBorderOffset()Gets the border offset of the scrollbar.- Returns:
- the border offset in pixels as an
int
-
setBorderOffset
public final void setBorderOffset(int borderOffset) Sets the border offset of the scrollbar.- Parameters:
borderOffset
- the border offset in pixels to set, specified as anint
-
getCompressedWidth
public final int getCompressedWidth()Gets the compressed width of the scrollbar.- Returns:
- the compressed width in pixels as an
int
-
setCompressedWidth
public final void setCompressedWidth(int compressedWidth) Sets the compressed width of the scrollbar.- Parameters:
compressedWidth
- the compressed width in pixels to set, specified as anint
-
updatePosition
public void updatePosition()Update theWidget
position -
onLeftMouseDown
public void onLeftMouseDown(int x, int y) Called when the left mouse button is pressed down over theWidget
.- Overrides:
onLeftMouseDown
in classPanelWidget
- Parameters:
x
- relative x-coordinate of the mouse positiony
- relative y-coordinate of the mouse position
-
onLeftMouseUpOutside
public void onLeftMouseUpOutside(int x, int y) Handles the left mouse button up event outside any visibleWidget
- Overrides:
onLeftMouseUpOutside
in classPanelWidget
- Parameters:
x
- absolute x-coordinate of the mouse positiony
- absolute y-coordinate of the mouse position
-
onLeftMouseUp
public void onLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget
.- Overrides:
onLeftMouseUp
in classPanelWidget
- Parameters:
x
- relative x-coordinate of the mouse positiony
- relative y-coordinate of the mouse position
-
update
public void update()Updates theWidget
- Overrides:
update
in classPanelWidget
-
render
public void render()Renders theWidget
- Overrides:
render
in classPanelWidget
-