CheckboxHandle
classclient onlysince 0.1.0com.galdurstudio.galdurui.api.window.CheckboxHandle
Handle to a checkbox of a GaldurWindow: read its state, change it and be told when it
changes.
Returned by GaldurWindow.addCheckbox(...). Like any ElementHandle, it can
also disable the checkbox, hide it or give it a tooltip.
The state lives here, not in the shown widget: Minecraft rebuilds widgets on every resize, so the checkbox stays checked (or not) and the widget reads this state back.
CheckboxHandle sound = window.addCheckbox(Component.literal("Enable sound"), false);sound.onChange(on -> System.out.println("Sound: " + on));sound.setChecked(true); // prints "Sound: true"MEMBERS · 9
Methods 9
setChecked
Checks or unchecks the checkbox.
When the value really changes, the action given to onChange() is called
with the new value, whether the change comes from the player or from code. Nothing happens
when the checkbox is already in that state.
PARAMETERS
true to check, false to uncheckisChecked
RETURNSboolean — true if the checkbox is checked
onChange
Sets the action called when the state changes.
Only one action is kept: a new call replaces the previous one. It receives the new state
(true if the checkbox was just checked).
PARAMETERS
setEnabled
from ElementHandleEnables or disables the element. No effect if it is already in that state.
PARAMETERS
false to disable itisEnabled
from ElementHandleRETURNSboolean — true if the element is enabled (the default)
setVisible
from ElementHandleShows or hides the element. Hidden, it frees its space in the window. No effect if it is already in that state.
PARAMETERS
false to hide itisVisible
from ElementHandleRETURNSboolean — true if the element is shown (the default)
setTooltip
from ElementHandleSets the text shown when the element is hovered.
PARAMETERS
null to remove itgetTooltip
from ElementHandleRETURNSComponent — the tooltip text, or null if none