Package com.spinyowl.legui.component
Class RadioButton
java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.AbstractTextComponent
com.spinyowl.legui.component.RadioButton
- All Implemented Interfaces:
TextComponent,Serializable
RadioButtons create a series of items where only one item can be checked.
By default all created radio buttons have no group so all of them can be checked.
Usage example:
RadioButtonGroup rbg = new RadioButtonGroup();
RadioButton rb1 = new RadioButton();
RadioButton rb2 = new RadioButton();
radioButton1.setRadioButtonGroup(radioButtonGroup);
radioButton2.setRadioButtonGroup(radioButtonGroup);
- See Also:
-
Field Summary
FieldsFields inherited from class com.spinyowl.legui.component.AbstractTextComponent
textState -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.RadioButton(float x, float y, float width, float height) Constructor with position and size parameters.RadioButton(String text) Default constructor.RadioButton(String text, float x, float y, float width, float height) Constructor with position and size parameters.RadioButton(String text, org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters.RadioButton(org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns radio image for checked state.Returns radio image for non-checked state.Returns current radio button group.inthashCode()booleanReturns true if radio button is checked.voidsetChecked(boolean checked) Used to set radio button checked or not.voidsetIconChecked(Icon iconChecked) Used to set radio image for checked state.voidsetIconUnchecked(Icon iconUnchecked) Used to set radio image for non-checked state.voidsetRadioButtonGroup(RadioButtonGroup radioButtonGroup) Used to set radio button group.toString()Methods inherited from class com.spinyowl.legui.component.AbstractTextComponent
getTextState, setTextStateMethods inherited from class com.spinyowl.legui.component.Component
add, add, addAll, clearChildComponents, containerIterator, contains, containsAll, count, forEach, getAbsolutePosition, getChildComponents, getFocusedStyle, getFrame, getHoveredStyle, getIntersector, getLayer, getListenerMap, getMetadata, getParent, getPosition, getPressedStyle, getSize, getStyle, getTabIndex, getTooltip, indexOfChild, intersects, isEmpty, isEnabled, isFocusable, isFocused, isHovered, isPressed, isTabFocusable, isVisible, keepRendering, keepRendering, parallelStream, remove, remove, removeAll, removeIf, setEnabled, setFocusable, setFocused, setHovered, setIntersector, setListenerMap, setParent, setPosition, setPosition, setPressed, setSize, setSize, setStyle, setTabFocusable, setTabIndex, setTooltip, stream
-
Field Details
-
DEFAULT_RADIO_BUTTON_TEXT
Default text for radiobutton.- See Also:
-
-
Constructor Details
-
RadioButton
public RadioButton()Default constructor. Used to create component instance without any parameters.Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.
-
RadioButton
public RadioButton(float x, float y, float width, float height) Constructor with position and size parameters.- Parameters:
x- x position position in parent component.y- y position position in parent component.width- width of component.height- height of component.
-
RadioButton
public RadioButton(org.joml.Vector2f position, org.joml.Vector2f size) Constructor with position and size parameters.- Parameters:
position- position position in parent component.size- size of component.
-
RadioButton
Default constructor. Used to create component instance without any parameters.Also if you want to make it easy to use with Json marshaller/unmarshaller component should contain empty constructor.
- Parameters:
text- text to set.
-
RadioButton
Constructor with position and size parameters.- Parameters:
text- text to set.x- x position position in parent component.y- y position position in parent component.width- width of component.height- height of component.
-
RadioButton
Constructor with position and size parameters.- Parameters:
text- text to set.position- position position in parent component.size- size of component.
-
-
Method Details
-
isChecked
public boolean isChecked()Returns true if radio button is checked.- Returns:
- true if radio button is checked.
-
setChecked
public void setChecked(boolean checked) Used to set radio button checked or not.- Parameters:
checked- true if it should be checked.
-
getRadioButtonGroup
Returns current radio button group.- Returns:
- current radio button group.
-
setRadioButtonGroup
Used to set radio button group.- Parameters:
radioButtonGroup- radio button group to set.
-
getIconUnchecked
Returns radio image for non-checked state.- Returns:
- radio image for non-checked state.
-
setIconUnchecked
Used to set radio image for non-checked state.- Parameters:
iconUnchecked- radio image for non-checked state to set.
-
getIconChecked
Returns radio image for checked state.- Returns:
- radio image for checked state.
-
setIconChecked
Used to set radio image for checked state.- Parameters:
iconChecked- radio image for checked state to set.
-
equals
-
hashCode
public int hashCode() -
toString
-