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
ConstructorsConstructorDescriptionConstructs aScrollbarWidgetwith a default vertical orientation.ScrollbarWidget(boolean horizontal) Constructs aScrollbarWidgetwith the specified orientation. -
Method Summary
Modifier and TypeMethodDescriptionfinal intGets the border offset of the scrollbar.final intGets the compressed width of the scrollbar.final NanoColorGets the color of the scrollbar thumb (the draggable part of the scrollbar).voidonLeftMouseDown(int x, int y) Called when the left mouse button is pressed down over theWidget.voidonLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget.voidonLeftMouseUpOutside(int x, int y) Handles the left mouse button up event outside any visibleWidgetvoidrender()Renders theWidgetfinal voidsetBorderOffset(int borderOffset) Sets the border offset of the scrollbar.final voidsetCompressedWidth(int compressedWidth) Sets the compressed width of the scrollbar.final voidsetThumbColor(NanoColor thumbColor) Sets the color of the scrollbar thumb (the draggable part of the scrollbar).voidupdate()Updates theWidgetvoidUpdate theWidgetpositionMethods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, postRender, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorderMethods 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 aScrollbarWidgetwith the specified orientation.- Parameters:
horizontal-trueif the scrollbar should be horizontal,falseif it should be vertical.
-
ScrollbarWidget
public ScrollbarWidget()Constructs aScrollbarWidgetwith 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
NanoColorobject
-
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 aNanoColorobject
-
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 theWidgetposition -
onLeftMouseDown
public void onLeftMouseDown(int x, int y) Called when the left mouse button is pressed down over theWidget.- Overrides:
onLeftMouseDownin 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:
onLeftMouseUpOutsidein 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:
onLeftMouseUpin classPanelWidget- Parameters:
x- relative x-coordinate of the mouse positiony- relative y-coordinate of the mouse position
-
update
public void update()Updates theWidget- Overrides:
updatein classPanelWidget
-
render
public void render()Renders theWidget- Overrides:
renderin classPanelWidget
-