Package com.avrix.ui.widgets
Class ColorPickerWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.ColorPickerWidget
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.-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionColorPickerWidget(int x, int y, int width, int height, NanoColor value) Constructs a newColorPickerWidgetwith the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionfinal intReturns the border offset of the widget.final StringReturns the name of the font used for displaying text.final intReturns the font size used for displaying text.Returns the action to be performed when the color value changes.final NanoColorReturns the text color used for displaying text on the widget.final NanoColorgetValue()Returns the currentNanoColorvalue being picked or adjusted.voidonLeftMouseUp(int x, int y) Called when the left mouse button is released over theWidget.voidrender()Renders theWidgetfinal voidsetBorderOffset(int borderOffset) Sets the border offset of the widget.final voidsetFontName(String fontName) Sets the name of the font used for displaying text.final voidsetFontSize(int fontSize) Sets the font size used for displaying text.final voidsetOnChangeColorAction(Consumer<NanoColor> onChangeColorAction) Sets the action to be performed when the color value changes.final voidsetTextColor(NanoColor textColor) Sets the text color used for displaying text on the widget.final voidSets the currentNanoColorvalue to be displayed and adjusted.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, onLeftMouseDown, onLeftMouseDownOutside, onLeftMouseUpOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, postRender, preRender, removeChild, removeFromScreen, renderChildren, setAlwaysOnTop, setHeight, setMaxScrollX, setMaxScrollY, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA, update
-
Constructor Details
-
ColorPickerWidget
Constructs a newColorPickerWidgetwith the specified position and size.
-
-
Method Details
-
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
-
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
Returns the name of the font used for displaying text.- Returns:
- the font name
-
setFontName
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
Returns the text color used for displaying text on the widget.- Returns:
- the text color
-
setTextColor
Sets the text color used for displaying text on the widget.- Parameters:
textColor- the new text color
-
getValue
Returns the currentNanoColorvalue being picked or adjusted.- Returns:
- the current color value
-
setValue
Sets the currentNanoColorvalue to be displayed and adjusted.- Parameters:
value- the new color value
-
getOnChangeColorAction
Returns the action to be performed when the color value changes. -
setOnChangeColorAction
Sets the action to be performed when the color value changes. -
render
public void render()Renders theWidget
-