CheckboxHandle
classclient uniquementdepuis 0.1.0com.galdurstudio.galdurui.api.window.CheckboxHandle
Pas encore traduit : texte d’origine en anglais.
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"MEMBRES · 9
Méthodes 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.
PARAMÈTRES
true to check, false to uncheckisChecked
RENVOIEboolean — 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).
PARAMÈTRES
setEnabled
de ElementHandleEnables or disables the element. No effect if it is already in that state.
PARAMÈTRES
false to disable itisEnabled
de ElementHandleRENVOIEboolean — true if the element is enabled (the default)
setVisible
de ElementHandleShows or hides the element. Hidden, it frees its space in the window. No effect if it is already in that state.
PARAMÈTRES
false to hide itisVisible
de ElementHandleRENVOIEboolean — true if the element is shown (the default)
setTooltip
de ElementHandleSets the text shown when the element is hovered.
PARAMÈTRES
null to remove itgetTooltip
de ElementHandleRENVOIEComponent — the tooltip text, or null if none