Class ColorPickerWidget

java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.ColorPickerWidget

public class ColorPickerWidget extends Widget
A ColorPickerWidget that allows the user to pick and adjust colors using sliders for red, green, blue, and alpha values. This widget displays a popup for color selection and provides an input field for hexadecimal color values.
  • Constructor Details

    • ColorPickerWidget

      public ColorPickerWidget(int x, int y, int width, int height, NanoColor value)
      Constructs a new ColorPickerWidget 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
      value - the initial NanoColor value to be displayed and adjusted
  • Method Details

    • 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
    • getFontSize

      public final int getFontSize()
      Returns the font size used for displaying text.
      Returns:
      the font size
    • setFontSize

      public final void setFontSize(int fontSize)
      Sets the font size used for displaying text.
      Parameters:
      fontSize - the new font size
    • getFontName

      public final String getFontName()
      Returns the name of the font used for displaying text.
      Returns:
      the font name
    • setFontName

      public final void setFontName(String fontName)
      Sets the name of the font used for displaying text.
      Parameters:
      fontName - the new font name
    • getBorderOffset

      public final int getBorderOffset()
      Returns the border offset of the widget.
      Returns:
      the border offset
    • setBorderOffset

      public final void setBorderOffset(int borderOffset)
      Sets the border offset of the widget.
      Parameters:
      borderOffset - the new border offset
    • getTextColor

      public final NanoColor getTextColor()
      Returns the text color used for displaying text on the widget.
      Returns:
      the text color
    • setTextColor

      public final void setTextColor(NanoColor textColor)
      Sets the text color used for displaying text on the widget.
      Parameters:
      textColor - the new text color
    • getValue

      public final NanoColor getValue()
      Returns the current NanoColor value being picked or adjusted.
      Returns:
      the current color value
    • setValue

      public final void setValue(NanoColor value)
      Sets the current NanoColor value to be displayed and adjusted.
      Parameters:
      value - the new color value
    • getOnChangeColorAction

      public final Consumer<NanoColor> getOnChangeColorAction()
      Returns the action to be performed when the color value changes.
      Returns:
      a Consumer of NanoColor representing the action to be performed on color change
    • setOnChangeColorAction

      public final void setOnChangeColorAction(Consumer<NanoColor> onChangeColorAction)
      Sets the action to be performed when the color value changes.
      Parameters:
      onChangeColorAction - a Consumer of NanoColor to be executed on color change
    • render

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