Aller au contenu
galdurdocs

ProgressHandle

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.window.ProgressHandle

Pas encore traduit : texte d’origine en anglais.

Handle to a progress bar of a GaldurWindow: its progress and the text shown on it.

Returned by addProgress(...). The shown widget reads the progress and the text every frame: change them as often as you like (every tick, for instance), even while the window is open, without rebuilding the screen.

Example.java
ProgressHandle craft = window.addProgress(Component.literal("Iron ingots: 0 / 64"));craft.setProgress(16, 64);craft.setLabel(Component.literal("Iron ingots: 16 / 64"));

The bar width is computed when the screen is built, from the text. A longer text given later is cut with "…" until the next rebuild (resize, or an element added to the window). Like any ElementHandle, the bar can be disabled (muted colours), hidden or given a tooltip.

Call on the client thread.

public class ProgressHandle extends ElementHandle
PAQUETapi.window
CÔTÉclient uniquement
HÉRITE DEElementHandle

MEMBRES · 11

Méthodes 10

getProgress

public double getProgress()

RENVOIEdouble — the progress, from 0 (empty) to 1 (full)

setProgress

2 surcharges
public void setProgress(double progress)
public void setProgress(long done, long total)

Changes the progress.

PARAMÈTRES

progressdoublefrom 0 (empty) to 1 (full); values outside are clamped, and NaN counts as 0
donelongwhat is done
totallongthe total; when 0 or less, the bar is empty

getLabel

public Component getLabel()

RENVOIEComponent — the text shown on the bar, or null if none

setLabel

public void setLabel(Component label)

Changes the text shown on the bar.

PARAMÈTRES

labelComponentthe new text, or null for none
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
public boolean isEnabled()

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

PARAMÈTRES

visiblebooleanfalse to hide it
public boolean isVisible()

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

public void setTooltip(Component tooltip)

Sets the text shown when the element is hovered.

PARAMÈTRES

tooltipComponentthe tooltip text, or null to remove it
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.