Skip to content

CheckboxHandle

classclient onlysince 0.1.0

com.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.

Example.java
CheckboxHandle sound = window.addCheckbox(Component.literal("Enable sound"), false);sound.onChange(on -> System.out.println("Sound: " + on));sound.setChecked(true);   // prints "Sound: true"
public class CheckboxHandle extends ElementHandle
PACKAGEapi.window
SIDEclient only

MEMBERS · 9

Methods 9

setChecked

public void setChecked(boolean checked)

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

checkedbooleantrue to check, false to uncheck

isChecked

public boolean isChecked()

RETURNSboolean — true if the checkbox is checked

onChange

public void onChange(Consumer<Boolean> action)

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

actionConsumer<Boolean>called on every state change
public void setEnabled(boolean enabled)

Enables or disables the element. No effect if it is already in that state.

PARAMETERS

enabledbooleanfalse to disable it
public boolean isEnabled()

RETURNSboolean — true if the element is enabled (the default)

public void setVisible(boolean visible)

Shows or hides the element. Hidden, it frees its space in the window. No effect if it is already in that state.

PARAMETERS

visiblebooleanfalse to hide it
public boolean isVisible()

RETURNSboolean — true if the element is shown (the default)

public void setTooltip(Component tooltip)

Sets the text shown when the element is hovered.

PARAMETERS

tooltipComponentthe tooltip text, or null to remove it
public Component getTooltip()

RETURNSComponent — the tooltip text, or null if none

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.