Package com.avrix.ui.widgets
Class ScrollPanelWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
com.avrix.ui.widgets.ScrollPanelWidget
- Direct Known Subclasses:
PopupWidget
,TableWidget
,WindowWidget
The
ScrollPanelWidget
class represents a panel widget that supports scrolling.
It extends the PanelWidget
class and adds functionality for managing scrollbars.-
Field Summary
-
Constructor Summary
ConstructorDescriptionScrollPanelWidget
(int x, int y, int width, int height) Constructs a newScrollPanelWidget
with the specified position and size.ScrollPanelWidget
(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newScrollPanelWidget
with the specified position, size, border radius, and background color. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child widget to thisWidget
's list of children.final ScrollbarWidget
Returns the horizontal scrollbarWidget
associated with this container.final ScrollbarWidget
Returns the vertical scrollbarWidget
associated with this container.void
Initializes theWidget
void
removeChild
(Widget widget) Removes a child widget from thisWidget
's list of children.void
Updates and renders all child widgets of thisWidget
.void
setMaxScrollX
(int maxScrollX) Sets the maximum horizontal scroll offset of the widget.void
setMaxScrollY
(int maxScrollY) Sets the maximum vertical scroll offset of the widget.void
update()
Updates theWidget
Methods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, onLeftMouseDown, onLeftMouseUp, onLeftMouseUpOutside, postRender, render, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorder
Methods inherited from class com.avrix.ui.widgets.Widget
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, onKeyPress, onKeyRelease, onKeyRepeat, onLeftMouseDownOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, preRender, removeFromScreen, setAlwaysOnTop, setHeight, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA
-
Constructor Details
-
ScrollPanelWidget
public ScrollPanelWidget(int x, int y, int width, int height) Constructs a newScrollPanelWidget
with the specified position and size. -
ScrollPanelWidget
public ScrollPanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newScrollPanelWidget
with the specified position, size, border radius, and background color.- Parameters:
x
- the X-coordinate of theWidget
's positiony
- the Y-coordinate of theWidget
's positionwidth
- the width of the widgetheight
- the height of the widgetborderRadius
- the radius of the corner rounding in pixelsbackgroundColor
- the background color of the widget, specified inNanoColor
-
-
Method Details
-
getVerticalScrollbar
Returns the vertical scrollbarWidget
associated with this container.- Returns:
- the vertical scrollbar
Widget
-
getHorizontalScrollbar
Returns the horizontal scrollbarWidget
associated with this container.- Returns:
- the horizontal scrollbar
Widget
-
onInitialize
public void onInitialize()Initializes theWidget
- Overrides:
onInitialize
in classWidget
-
removeChild
Removes a child widget from thisWidget
's list of children.- Overrides:
removeChild
in classWidget
- Parameters:
widget
- the widget to remove from the list of children
-
addChild
Adds a child widget to thisWidget
's list of children. -
renderChildren
public void renderChildren()Updates and renders all child widgets of thisWidget
. This method recursively calls the update and render methods on each childWidget
, ensuring that the rendering order respects the hierarchy ofWidget
s.- Overrides:
renderChildren
in classWidget
-
setMaxScrollX
public void setMaxScrollX(int maxScrollX) Sets the maximum horizontal scroll offset of the widget. This value determines the limit for horizontal scrolling based on the content width.- Overrides:
setMaxScrollX
in classWidget
- Parameters:
maxScrollX
- the new maximum horizontal scroll offset
-
setMaxScrollY
public void setMaxScrollY(int maxScrollY) Sets the maximum vertical scroll offset of the widget. This value determines the limit for vertical scrolling based on the content height.- Overrides:
setMaxScrollY
in classWidget
- Parameters:
maxScrollY
- the new maximum vertical scroll offset
-
update
public void update()Updates theWidget
- Overrides:
update
in classPanelWidget
-