Package com.avrix.ui.widgets
Class WindowWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.PanelWidget
com.avrix.ui.widgets.ScrollPanelWidget
com.avrix.ui.widgets.WindowWidget
Represents a
Widget panel that can be customized with various properties such as font, title,
header color, and header height.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionWindowWidget(String title, int x, int y, int width, int height) Constructs a newWidgetwith the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child widget to this widget's list of children.final voidClosing a window (removes it from the screen)final StringGets the current font name used by theWidget.final intReturns the height of theWidget's headerfinal intReturns the minimum width of the widget.final intReturns the minimum height of the widget.final StringgetTitle()Gets the current title of theWidget's header.final booleanChecks if the widget is resizable.voidInitializes theWidgetvoidonLeftMouseDown(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 elementsvoidremoveChild(Widget widget) Removes a child widget from this widget's list of children.voidrender()Renders theWidgetvoidUpdates and renders all child widgets of thisWidget.final voidSets the font name for theWidget.final voidsetHeaderColor(NanoColor headerColor) Sets the color of theWidget's header.final voidsetHeaderHeight(int headerHeight) Sets the height of theWidget's header.final voidsetMinSizeX(int minSizeX) Sets the minimum width of the widget.final voidsetMinSizeY(int minSizeY) Sets the minimum height of the widget.final voidsetResizable(boolean resizable) Sets the ability to resize the widget.final voidSets the title of theWidget's header.voidupdate()Updates theWidgetMethods inherited from class com.avrix.ui.widgets.ScrollPanelWidget
getHorizontalScrollbar, getVerticalScrollbar, setMaxScrollX, setMaxScrollYMethods inherited from class com.avrix.ui.widgets.PanelWidget
isDraggable, 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
-
Method Details
-
closeWindow
public final void closeWindow()Closing a window (removes it from the screen) -
onInitialize
public void onInitialize()Initializes theWidget- Overrides:
onInitializein classScrollPanelWidget
-
getMinSizeX
public final int getMinSizeX()Returns the minimum width of the widget.- Returns:
- the minimum width of the widget in pixels.
-
setMinSizeX
public final void setMinSizeX(int minSizeX) Sets the minimum width of the widget.- Parameters:
minSizeX- the minimum width of the widget in pixels.
-
getMinSizeY
public final int getMinSizeY()Returns the minimum height of the widget.- Returns:
- the minimum height of the widget in pixels.
-
setMinSizeY
public final void setMinSizeY(int minSizeY) Sets the minimum height of the widget.- Parameters:
minSizeY- the minimum height of the widget in pixels.
-
isResizable
public final boolean isResizable()Checks if the widget is resizable.- Returns:
trueif the widget is resizable,falseotherwise.
-
setResizable
public final void setResizable(boolean resizable) Sets the ability to resize the widget.- Parameters:
resizable-trueif the widget is resizable,falseotherwise.
-
addChild
Adds a child widget to this widget's list of children.- Overrides:
addChildin classScrollPanelWidget- Parameters:
widget- the widget to add as a child
-
removeChild
Removes a child widget from this widget's list of children.- Overrides:
removeChildin classScrollPanelWidget- Parameters:
widget- the widget to remove from the list of children
-
setFont
Sets the font name for theWidget.- Parameters:
fontName- the name of the font to use, specified as a string (e.g., "Arial", "Helvetica")
-
setTitle
Sets the title of theWidget's header.- Parameters:
title- the title text to display in the header
-
getFontName
Gets the current font name used by theWidget.- Returns:
- the name of the font being used
-
getTitle
Gets the current title of theWidget's header.- Returns:
- the title text currently set for the header
-
setHeaderColor
Sets the color of theWidget's header.- Parameters:
headerColor- the color to use for the header
-
setHeaderHeight
public final void setHeaderHeight(int headerHeight) Sets the height of theWidget's header.- Parameters:
headerHeight- the height of the header in pixels
-
getHeaderHeight
public final int getHeaderHeight()Returns the height of theWidget's header- Returns:
- header height in pixels
-
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 classScrollPanelWidget
-
renderChildren
public void renderChildren()Updates and renders all child widgets of thisWidget. This method recursively calls the update and render methods on each child widget, ensuring that the rendering order respects the hierarchy of widgets.- Overrides:
renderChildrenin classScrollPanelWidget
-
render
public void render()Renders theWidget- Overrides:
renderin classPanelWidget
-
postRender
public void postRender()Final rendering, after the main render and rendering of child elements- Overrides:
postRenderin classPanelWidget
-