Package com.avrix.ui.widgets
Class PanelWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
- Direct Known Subclasses:
ButtonWidget,ComboBoxWidget,InputTextWidget,RadioButtonWidget.RadioValue,ScrollbarWidget,ScrollPanelWidget
Represents a panel
Widget with optional rounded corners, borders, and drag functionality.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPanelWidget(int x, int y, int width, int height) Constructs a newWidgetwith the specified position and size.PanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newPanelWidgetwith the specified position, size, border radius, and background color. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanChecks if theWidgetis draggable.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 visibleWidgetvoidFinal rendering, after the main render and rendering of child elementsvoidrender()Renders theWidgetfinal voidsetBackgroundColor(NanoColor color) Sets the background color of theWidget.final voidsetBorderColor(NanoColor color) Sets the border color of the widget.final voidsetBorderRadius(int radius) Sets the radius of theWidget's corner rounding.final voidsetBorderWidth(int borderWidth) Sets the border width of the widget.final voidsetDraggable(boolean draggable) Sets whether theWidgetis draggable.final voidsetDrawBorder(boolean drawBorder) Sets whether to draw theWidgetborder.voidupdate()Updates theWidgetMethods 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
-
PanelWidget
public PanelWidget(int x, int y, int width, int height) Constructs a newWidgetwith the specified position and size. -
PanelWidget
public PanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newPanelWidgetwith 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
-
setDraggable
public final void setDraggable(boolean draggable) Sets whether theWidgetis draggable.- Parameters:
draggable- true if theWidgetis draggable; otherwise false
-
isDraggable
public final boolean isDraggable()Checks if theWidgetis draggable.- Returns:
- true if the
Widgetis draggable; otherwise false
-
setBackgroundColor
Sets the background color of theWidget.- Parameters:
color- the background color, specified inNanoColor
-
setBorderColor
Sets the border color of the widget.- Parameters:
color- the border color, specified inNanoColor
-
setBorderWidth
public final void setBorderWidth(int borderWidth) Sets the border width of the widget.- Parameters:
borderWidth- the border width in pixels
-
setDrawBorder
public final void setDrawBorder(boolean drawBorder) Sets whether to draw theWidgetborder.- Parameters:
drawBorder- true if the border should be drawn; otherwise false
-
setBorderRadius
public final void setBorderRadius(int radius) Sets the radius of theWidget's corner rounding.- Parameters:
radius- the radius of the corner rounding in pixels
-
onLeftMouseUp
public void onLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget.- Overrides:
onLeftMouseUpin classWidget- 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 classWidget- Parameters:
x- absolute x-coordinate of the mouse positiony- absolute y-coordinate of the mouse position
-
onLeftMouseDown
public void onLeftMouseDown(int x, int y) Called when the left mouse button is pressed down over theWidget.- Overrides:
onLeftMouseDownin classWidget- Parameters:
x- relative x-coordinate of the mouse positiony- relative y-coordinate of the mouse position
-
update
public void update()Updates theWidget -
render
public void render()Renders theWidget -
postRender
public void postRender()Final rendering, after the main render and rendering of child elements- Overrides:
postRenderin classWidget
-