Aller au contenu
galdurdocs

ElementHandle

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.window.ElementHandle

Pas encore traduit : texte d’origine en anglais.

Handle to an element of a GaldurWindow: disable it, hide it or give it a tooltip, before or after the window opens.

Returned by every GaldurWindow.add...(...). As with CheckboxHandle, the state lives here, not in the shown widget: Minecraft rebuilds widgets on every resize, and they read this state back.

Example.java
ElementHandle confirm = window.addButton(Component.literal("Confirm"), this::confirm);confirm.setEnabled(false);confirm.setTooltip(Component.literal("Fill in the form first"));ElementHandle details = window.addText(Component.literal("Details..."));details.setVisible(false);   // the element disappears and frees its space
  • Disabled: drawn in a muted colour, ignores mouse and keyboard. The tooltip still shows on hover, to explain why.
  • Hidden: not drawn and frees its space; the window lays itself out again without it.
  • Tooltip: text shown when the element is hovered.

A change made while the window is shown is visible on the next frame. Call on the client thread.

public class ElementHandle
PAQUETapi.window
CÔTÉclient uniquement
THREADthread client

Méthodes 6

setEnabled

public void setEnabled(boolean enabled)

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

PARAMÈTRES

enabledbooleanfalse to disable it

isEnabled

public boolean isEnabled()

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

setVisible

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.

PARAMÈTRES

visiblebooleanfalse to hide it

isVisible

public boolean isVisible()

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

setTooltip

public void setTooltip(Component tooltip)

Sets the text shown when the element is hovered.

PARAMÈTRES

tooltipComponentthe tooltip text, or null to remove it

getTooltip

public Component getTooltip()

RENVOIEComponent — the tooltip text, or null if none

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