Package com.spinyowl.legui.component
Class ToggleButton
java.lang.Object
com.spinyowl.legui.component.Component
com.spinyowl.legui.component.AbstractTextComponent
com.spinyowl.legui.component.Button
com.spinyowl.legui.component.ToggleButton
- All Implemented Interfaces:
TextComponent,Serializable
An implementation of "toggle" button. Behavior the same as checkbox but have not any text.
- See Also:
-
Field Summary
Fields inherited from class com.spinyowl.legui.component.Button
DEFAULT_BUTTON_TEXTFields inherited from class com.spinyowl.legui.component.AbstractTextComponent
textState -
Constructor Summary
ConstructorsConstructorDescriptionCreates toggle button with default bg color and default toggled bg color.ToggleButton(float x, float y, float width, float height) Creates a button with specified position and size and default bg color and default toggled bg color.ToggleButton(String text) Creates toggle button with default bg color, toggled bg color and specified text.ToggleButton(String text, float x, float y, float width, float height) Creates a button with specified text and specified position and size.ToggleButton(org.joml.Vector2f position, org.joml.Vector2f size) Creates a button with specified position and size and default bg color and default toggled bg color. -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.joml.Vector4fReturns background color which will be used as background color if button toggled.Returns toggled background icon.inthashCode()booleanReturns true if toggle button is toggled.voidsetToggled(boolean toggled) Used to change toggled state.voidsetToggledBackgroundColor(org.joml.Vector4f toggledBackgroundColor) Used to change background color which will be used as background color if button toggled.voidsetTogglededBackgroundIcon(Icon togglededBackgroundIcon) Used to change toggled background icon.toString()Methods inherited from class com.spinyowl.legui.component.Button
getTextDirection, setTextDirectionMethods 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
-
Constructor Details
-
ToggleButton
Creates a button with specified text and specified position and size.- Parameters:
text- button text.x- x position in parent.y- y position in parent.width- width of component.height- height of component.
-
ToggleButton
public ToggleButton()Creates toggle button with default bg color and default toggled bg color. -
ToggleButton
Creates toggle button with default bg color, toggled bg color and specified text.- Parameters:
text- button text.
-
ToggleButton
public ToggleButton(float x, float y, float width, float height) Creates a button with specified position and size and default bg color and default toggled bg color.- Parameters:
x- x position in parent.y- y position in parent.width- width of component.height- height of component.
-
ToggleButton
public ToggleButton(org.joml.Vector2f position, org.joml.Vector2f size) Creates a button with specified position and size and default bg color and default toggled bg color.- Parameters:
position- position in parent.size- size of component.
-
-
Method Details
-
isToggled
public boolean isToggled()Returns true if toggle button is toggled.- Returns:
- true if toggle button is toggled.
-
setToggled
public void setToggled(boolean toggled) Used to change toggled state.- Parameters:
toggled- new value.
-
getToggledBackgroundColor
public org.joml.Vector4f getToggledBackgroundColor()Returns background color which will be used as background color if button toggled.- Returns:
- toggled button color.
-
setToggledBackgroundColor
public void setToggledBackgroundColor(org.joml.Vector4f toggledBackgroundColor) Used to change background color which will be used as background color if button toggled.- Parameters:
toggledBackgroundColor- new value.
-
getTogglededBackgroundIcon
Returns toggled background icon.- Returns:
- toggled background icon.
-
setTogglededBackgroundIcon
Used to change toggled background icon.- Parameters:
togglededBackgroundIcon- toggled background icon.
-
equals
-
hashCode
public int hashCode() -
toString
-