Aller au contenu
galdurdocs

GaldurCheckbox

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.widget.GaldurCheckbox

Pas encore traduit : texte d’origine en anglais.

Themed checkbox.

The widget does not store the state: it reads it every frame from a supplier and asks for changes through a callback. The state lives elsewhere (a GaldurWindow handle, for instance), so it survives the widget being rebuilt on resize.

Example.java
boolean[] sound = {false};column.addChild(GaldurCheckbox.of(Component.literal("Enable sound"),        () -> sound[0], value -> sound[0] = value));
public class GaldurCheckbox extends AbstractWidget
PAQUETapi.widget
CÔTÉclient uniquement
HÉRITE DEAbstractWidget

Constructeurs 1

GaldurCheckbox

protected
protected GaldurCheckbox(Component label, BooleanSupplier checked, Consumer<Boolean> onToggle)

PARAMÈTRES

labelComponenttext right of the box
checkedBooleanSuppliersupplier of the current state, called every frame
onToggleConsumer<Boolean>receives the wanted value when the player toggles the box

Méthodes 2

of

static
public static GaldurCheckbox of(Component label, BooleanSupplier checked, Consumer<Boolean> onToggle)

PARAMÈTRES

labelComponent—
checkedBooleanSupplier—
onToggleConsumer<Boolean>—

RENVOIEGaldurCheckbox — a checkbox at (0, 0), for a layout to place

onClick

public void onClick(double mouseX, double mouseY, int button)

Only remembers the press: the box toggles on release, so the player can cancel by releasing elsewhere.

PARAMÈTRES

mouseXdouble—
mouseYdouble—
buttonint—
© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyProduit non officiel. Non approuvé par Mojang ou Microsoft, ni associé à eux.