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
ConstructorDescriptionColorPickerWidget
(int x, int y, int width, int height, NanoColor value) Constructs a newColorPickerWidget
with the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
Returns the border offset of the widget.final String
Returns the name of the font used for displaying text.final int
Returns the font size used for displaying text.Returns the action to be performed when the color value changes.final NanoColor
Returns the text color used for displaying text on the widget.final NanoColor
getValue()
Returns the currentNanoColor
value being picked or adjusted.void
onLeftMouseUp
(int x, int y) Called when the left mouse button is released over theWidget
.void
render()
Renders theWidget
final void
setBorderOffset
(int borderOffset) Sets the border offset of the widget.final void
setFontName
(String fontName) Sets the name of the font used for displaying text.final void
setFontSize
(int fontSize) Sets the font size used for displaying text.final void
setOnChangeColorAction
(Consumer<NanoColor> onChangeColorAction) Sets the action to be performed when the color value changes.final void
setTextColor
(NanoColor textColor) Sets the text color used for displaying text on the widget.final void
Sets the currentNanoColor
value 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 newColorPickerWidget
with 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:
onLeftMouseUp
in 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 currentNanoColor
value being picked or adjusted.- Returns:
- the current color value
-
setValue
Sets the currentNanoColor
value 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
-