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
ConstructorDescriptionPanelWidget
(int x, int y, int width, int height) Constructs a newWidget
with the specified position and size.PanelWidget
(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newPanelWidget
with the specified position, size, border radius, and background color. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Checks if theWidget
is draggable.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
Final rendering, after the main render and rendering of child elementsvoid
render()
Renders theWidget
final void
setBackgroundColor
(NanoColor color) Sets the background color of theWidget
.final void
setBorderColor
(NanoColor color) Sets the border color of the widget.final void
setBorderRadius
(int radius) Sets the radius of theWidget
's corner rounding.final void
setBorderWidth
(int borderWidth) Sets the border width of the widget.final void
setDraggable
(boolean draggable) Sets whether theWidget
is draggable.final void
setDrawBorder
(boolean drawBorder) Sets whether to draw theWidget
border.void
update()
Updates theWidget
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
-
PanelWidget
public PanelWidget(int x, int y, int width, int height) Constructs a newWidget
with the specified position and size. -
PanelWidget
public PanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor) Constructs a newPanelWidget
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
-
setDraggable
public final void setDraggable(boolean draggable) Sets whether theWidget
is draggable.- Parameters:
draggable
- true if theWidget
is draggable; otherwise false
-
isDraggable
public final boolean isDraggable()Checks if theWidget
is draggable.- Returns:
- true if the
Widget
is 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 theWidget
border.- 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:
onLeftMouseUp
in 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:
onLeftMouseUpOutside
in 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:
onLeftMouseDown
in 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:
postRender
in classWidget
-