Skip to content

ElementHandle

classclient onlysince 0.1.0

com.galdurstudio.galdurui.api.window.ElementHandle

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
PACKAGEapi.window
SIDEclient only
THREADclient thread

Methods 6

setEnabled

public void setEnabled(boolean enabled)

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

PARAMETERS

enabledbooleanfalse to disable it

isEnabled

public boolean isEnabled()

RETURNSboolean — 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.

PARAMETERS

visiblebooleanfalse to hide it

isVisible

public boolean isVisible()

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

setTooltip

public void setTooltip(Component tooltip)

Sets the text shown when the element is hovered.

PARAMETERS

tooltipComponentthe tooltip text, or null to remove it

getTooltip

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.