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

public class PanelWidget extends Widget
Represents a panel Widget with optional rounded corners, borders, and drag functionality.
  • Constructor Details

    • PanelWidget

      public PanelWidget(int x, int y, int width, int height)
      Constructs a new Widget with the specified position and size.
      Parameters:
      x - the x-coordinate of the Widget's position
      y - the y-coordinate of the Widget's position
      width - the width of the Widget
      height - the height of the Widget
    • PanelWidget

      public PanelWidget(int x, int y, int width, int height, int borderRadius, NanoColor backgroundColor)
      Constructs a new PanelWidget with the specified position, size, border radius, and background color.
      Parameters:
      x - the X-coordinate of the Widget's position
      y - the Y-coordinate of the Widget's position
      width - the width of the widget
      height - the height of the widget
      borderRadius - the radius of the corner rounding in pixels
      backgroundColor - the background color of the widget, specified in NanoColor
  • Method Details

    • setDraggable

      public final void setDraggable(boolean draggable)
      Sets whether the Widget is draggable.
      Parameters:
      draggable - true if the Widget is draggable; otherwise false
    • isDraggable

      public final boolean isDraggable()
      Checks if the Widget is draggable.
      Returns:
      true if the Widget is draggable; otherwise false
    • setBackgroundColor

      public final void setBackgroundColor(NanoColor color)
      Sets the background color of the Widget.
      Parameters:
      color - the background color, specified in NanoColor
    • setBorderColor

      public final void setBorderColor(NanoColor color)
      Sets the border color of the widget.
      Parameters:
      color - the border color, specified in NanoColor
    • 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 the Widget border.
      Parameters:
      drawBorder - true if the border should be drawn; otherwise false
    • setBorderRadius

      public final void setBorderRadius(int radius)
      Sets the radius of the Widget'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 the Widget.
      Overrides:
      onLeftMouseUp in class Widget
      Parameters:
      x - relative x-coordinate of the mouse position
      y - relative y-coordinate of the mouse position
    • onLeftMouseUpOutside

      public void onLeftMouseUpOutside(int x, int y)
      Handles the left mouse button up event outside any visible Widget
      Overrides:
      onLeftMouseUpOutside in class Widget
      Parameters:
      x - absolute x-coordinate of the mouse position
      y - 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 the Widget.
      Overrides:
      onLeftMouseDown in class Widget
      Parameters:
      x - relative x-coordinate of the mouse position
      y - relative y-coordinate of the mouse position
    • update

      public void update()
      Updates the Widget
      Overrides:
      update in class Widget
    • render

      public void render()
      Renders the Widget
      Specified by:
      render in class Widget
    • postRender

      public void postRender()
      Final rendering, after the main render and rendering of child elements
      Overrides:
      postRender in class Widget