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
ConstructorsConstructorDescriptionScrollPanelWidget(int x, int y, int width, int height) Constructs a newScrollPanelWidgetwith the specified position and size.ScrollPanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newScrollPanelWidgetwith the specified position, size, border radius, and background color. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child widget to thisWidget's list of children.final ScrollbarWidgetReturns the horizontal scrollbarWidgetassociated with this container.final ScrollbarWidgetReturns the vertical scrollbarWidgetassociated with this container.voidInitializes theWidgetvoidremoveChild(Widget widget) Removes a child widget from thisWidget's list of children.voidUpdates and renders all child widgets of thisWidget.voidsetMaxScrollX(int maxScrollX) Sets the maximum horizontal scroll offset of the widget.voidsetMaxScrollY(int maxScrollY) Sets the maximum vertical scroll offset of the widget.voidupdate()Updates theWidgetMethods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, onLeftMouseDown, onLeftMouseUp, onLeftMouseUpOutside, postRender, render, setBackgroundColor, setBorderColor, setBorderRadius, setBorderWidth, setDraggable, setDrawBorderMethods 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 newScrollPanelWidgetwith the specified position and size. -
ScrollPanelWidget
public ScrollPanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newScrollPanelWidgetwith 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 scrollbarWidgetassociated with this container.- Returns:
- the vertical scrollbar
Widget
-
getHorizontalScrollbar
Returns the horizontal scrollbarWidgetassociated with this container.- Returns:
- the horizontal scrollbar
Widget
-
onInitialize
public void onInitialize()Initializes theWidget- Overrides:
onInitializein classWidget
-
removeChild
Removes a child widget from thisWidget's list of children.- Overrides:
removeChildin 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 ofWidgets.- Overrides:
renderChildrenin 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:
setMaxScrollXin 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:
setMaxScrollYin classWidget- Parameters:
maxScrollY- the new maximum vertical scroll offset
-
update
public void update()Updates theWidget- Overrides:
updatein classPanelWidget
-