Skip to content

SearchHandle

classclient onlysince 0.1.0

com.galdurstudio.galdurui.api.window.SearchHandle

Handle to a search field of a GaldurWindow: its text, and the action called on every keystroke.

Returned by GaldurWindow.addSearch(...). As with CheckboxHandle, the state lives here, not in the shown widget: the text survives resizes, and setText() changes it even while the window is open, without rebuilding the screen.

Example.java
SearchHandle search = window.addSearch(Component.literal("Search..."));ListHandle results = window.addList(6);search.onChange(text -> results.setLines(filter(all, text)));

Like any ElementHandle, the field can be disabled, hidden or given a tooltip. Call on the client thread.

public class SearchHandle extends ElementHandle
PACKAGEapi.window
SIDEclient only

MEMBERS · 9

Methods 9

getText

public String getText()

RETURNSString — the typed text, never null; empty at first

setText

public void setText(String text)

Changes the field text. When the value really changes, the action given to onChange() is called, whether the change comes from the player or from code.

PARAMETERS

textStringthe new text; null counts as empty

onChange

public void onChange(Consumer<String> action)

Sets the action called when the text changes, on every keystroke. Only one action is kept: a new call replaces the previous one.

PARAMETERS

actionConsumer<String>receives the new text
public void setEnabled(boolean enabled)

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

PARAMETERS

enabledbooleanfalse to disable it
public boolean isEnabled()

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

PARAMETERS

visiblebooleanfalse to hide it
public boolean isVisible()

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

public void setTooltip(Component tooltip)

Sets the text shown when the element is hovered.

PARAMETERS

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