Package com.avrix.ui.widgets
Class RadioButtonWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.RadioButtonWidget
A
Widget that represents a set of radio buttons.
The radio buttons can be arranged either horizontally or vertically.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresents a single radio button within theRadioButtonWidget. -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionRadioButtonWidget(int x, int y, int width, int height, boolean horizontal, BiConsumer<Integer, String> onChangeAction) Constructs aRadioButtonWidgetwith the specified position, size, and arrangement. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new radio button to theRadioButtonWidget.final NanoColorReturns the color used to accent the selected radio button.final NanoColorReturns the color of the circles representing the radio buttons.final intReturns the radius of the circles representing the radio buttons.final StringReturns the font name used to render the text in the radio buttons.final intReturns the font size used to render the text in the radio buttons.final intReturns the offset between radio buttons.final intReturns the height of each radio button.final intReturns the width of each radio button.final NanoColorReturns the color of the text in the radio buttons.final intRetrieves the index of the currently selected radio button.final List<RadioButtonWidget.RadioValue>Returns the list ofRadioButtonWidget.RadioValueobjects representing the radio button options.final StringRetrieves the text of the currently selected radio button.final StringgetValueText(int index) Retrieves the text of the radio button at the specified index.voidrender()Renders theWidget.voidResizes theRadioButtonWidgetto fit its content based on the arrangement.final voidsetAccentColor(NanoColor accentColor) Sets the color used to accent the selected radio button.final voidsetCircleColor(NanoColor circleColor) Sets the color of the circles representing the radio buttons.final voidsetCircleRadius(int circleRadius) Sets the radius of the circles representing the radio buttons.final voidsetFontName(String fontName) Sets the font name used to render the text in the radio buttons.final voidsetFontSize(int fontSize) Sets the font size used to render the text in the radio buttons.final voidsetOffset(int offset) Sets the offset between radio buttons.final voidsetRadioHeight(int radioHeight) Sets the height of each radio button.final voidsetRadioWidth(int radioWidth) Sets the width of each radio button.final voidsetTextColor(NanoColor textColor) Sets the color of the text in the radio buttons.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, onLeftMouseUp, 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
-
RadioButtonWidget
public RadioButtonWidget(int x, int y, int width, int height, boolean horizontal, BiConsumer<Integer, String> onChangeAction) Constructs aRadioButtonWidgetwith the specified position, size, and arrangement.
-
-
Method Details
-
resizeToContent
public void resizeToContent()Resizes theRadioButtonWidgetto fit its content based on the arrangement. Adjusts the width and height according to the number of radio buttons and their dimensions. -
addRadio
Adds a new radio button to theRadioButtonWidget.- Parameters:
titleText- the text to display on the new radio button
-
getValues
Returns the list ofRadioButtonWidget.RadioValueobjects representing the radio button options.- Returns:
- the list of
RadioButtonWidget.RadioValueobjects
-
getValueText
Retrieves the text of the currently selected radio button.- Returns:
- the text of the currently selected radio button, or
nullif no radio button is selected
-
getValueText
Retrieves the text of the radio button at the specified index.- Parameters:
index- the index of the radio button whose text is to be retrieved- Returns:
- the text of the radio button at the specified index, or
nullif the index is out of bounds
-
getValueIndex
public final int getValueIndex()Retrieves the index of the currently selected radio button.- Returns:
- the index of the currently selected radio button, or
-1if no radio button is selected
-
getFontName
Returns the font name used to render the text in the radio buttons.- Returns:
- the font name
-
setFontName
Sets the font name used to render the text in the radio buttons.- Parameters:
fontName- the font name
-
getFontSize
public final int getFontSize()Returns the font size used to render the text in the radio buttons.- Returns:
- the font size
-
setFontSize
public final void setFontSize(int fontSize) Sets the font size used to render the text in the radio buttons.- Parameters:
fontSize- the font size
-
getOffset
public final int getOffset()Returns the offset between radio buttons.- Returns:
- the offset
-
setOffset
public final void setOffset(int offset) Sets the offset between radio buttons.- Parameters:
offset- the offset
-
getCircleRadius
public final int getCircleRadius()Returns the radius of the circles representing the radio buttons.- Returns:
- the circle radius
-
setCircleRadius
public final void setCircleRadius(int circleRadius) Sets the radius of the circles representing the radio buttons.- Parameters:
circleRadius- the circle radius
-
getRadioHeight
public final int getRadioHeight()Returns the height of each radio button.- Returns:
- the radio button height
-
setRadioHeight
public final void setRadioHeight(int radioHeight) Sets the height of each radio button.- Parameters:
radioHeight- the radio button height
-
getRadioWidth
public final int getRadioWidth()Returns the width of each radio button.- Returns:
- the radio button width
-
setRadioWidth
public final void setRadioWidth(int radioWidth) Sets the width of each radio button.- Parameters:
radioWidth- the radio button width
-
getTextColor
Returns the color of the text in the radio buttons.- Returns:
- the text color
-
setTextColor
Sets the color of the text in the radio buttons.- Parameters:
textColor- the text color
-
getAccentColor
Returns the color used to accent the selected radio button.- Returns:
- the accent color
-
setAccentColor
Sets the color used to accent the selected radio button.- Parameters:
accentColor- the accent color
-
getCircleColor
Returns the color of the circles representing the radio buttons.- Returns:
- the circle color
-
setCircleColor
Sets the color of the circles representing the radio buttons.- Parameters:
circleColor- the circle color
-
render
public void render()Renders theWidget. This implementation does not perform rendering; rendering is handled by the nestedRadioButtonWidget.RadioValueclass.
-