ElementHandle
classclient uniquementdepuis 0.1.0com.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.
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.
Méthodes 6
setEnabled
Enables or disables the element. No effect if it is already in that state.
PARAMÈTRES
false to disable itisEnabled
RENVOIEboolean — true if the element is enabled (the default)
setVisible
Shows 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
RENVOIEboolean — true if the element is shown (the default)
setTooltip
Sets the text shown when the element is hovered.
PARAMÈTRES
null to remove itgetTooltip
RENVOIEComponent — the tooltip text, or null if none