Skip to content

TabHandle

classclient onlysince 0.1.0

com.galdurstudio.galdurui.api.window.TabHandle

Handle to one tab of a tab row (TabsHandle): its content, filled like a window with the add...(...) methods inherited from ElementContainer.

Example.java
TabHandle storage = tabs.addTab(Component.literal("Storage"));SearchHandle search = storage.addSearch(Component.literal("Search..."));ListHandle items = storage.addList(6);

The content is only shown while the tab is active, but its handles stay usable at any time: a change in a hidden tab shows when the player comes back. A tab does not contain another tab row.

Call on the client thread.

public class TabHandle extends ElementContainer
PACKAGEapi.window
SIDEclient only

MEMBERS · 23

Methods 12

getIndex

public int getIndex()

RETURNSint — the tab position in its row, starting at 0

isSelected

public boolean isSelected()

RETURNSboolean — true if this tab is the active one

select

public void select()

Makes this tab active; same as setSelected(getIndex()) on the row.

addText

from ElementContainer2 overloads
public ElementHandle addText(Component text)
public ElementHandle addText(Component text, boolean centered)

Adds a left-aligned line of text at the end; see addText() to centre it.

PARAMETERS

textComponentthe text to show
centeredbooleantrue to centre it, false to align it left

RETURNSElementHandle — the element's handle (disable, hide, tooltip)

addTitle

from ElementContainer2 overloads
public ElementHandle addTitle(Component text)
public ElementHandle addTitle(Component text, boolean centered)

Adds a left-aligned title at the end; see addTitle() to centre it.

A title differs from plain text by its style. It usually comes first, but nothing enforces it: elements stay in call order.

PARAMETERS

textComponentthe title to show
centeredbooleantrue to centre it, false to align it left

RETURNSElementHandle — the element's handle (disable, hide, tooltip)

addButton

from ElementContainer2 overloads
public ElementHandle addButton(Component label, Runnable action)
public ElementHandle addButton(Component label, Runnable action, boolean centered)

Adds a left-aligned button at the end; see addButton() to centre it.

The action runs every time the button is activated, by mouse or keyboard.

PARAMETERS

labelComponentthe button label
actionRunnablerun when the button is activated
centeredbooleantrue to centre it, false to align it left

RETURNSElementHandle — the element's handle (disable, hide, tooltip)

addIconButton

from ElementContainer4 overloads
public ElementHandle addIconButton(ItemStack icon, Component label, Runnable action)
public ElementHandle addIconButton(ItemStack icon, Component label, Runnable action, boolean centered)
public ElementHandle addIconButton(ResourceLocation sprite, Component label, Runnable action)
public ElementHandle addIconButton(ResourceLocation sprite, Component label, Runnable action, boolean centered)

Adds a left-aligned icon button showing an item at the end; see addIconButton() to centre it.

The label is not drawn on the button: it is the tooltip and the narrated text. A tooltip set on the handle replaces it. For several icons side by side, use a row (RowHandle.addIconButton()).

PARAMETERS

iconItemStackthe shown item; copied
labelComponenttooltip and narration text
actionRunnablerun when the button is activated
centeredbooleantrue to centre it, false to align it left
spriteResourceLocationsprite id in the GUI atlas

RETURNSElementHandle — the element's handle (disable, hide, tooltip)

Source ↗

addCheckbox

from ElementContainer2 overloads
public CheckboxHandle addCheckbox(Component label, boolean defaultState)
public CheckboxHandle addCheckbox(Component label, boolean defaultState, boolean centered)

Adds a left-aligned checkbox at the end and returns its handle; see addCheckbox() to centre it.

The handle reads and changes the state, reports changes and, like any ElementHandle, disables, hides or gives a tooltip to the checkbox.

PARAMETERS

labelComponentthe text next to the box
defaultStatebooleantrue if the checkbox is checked on open
centeredbooleantrue to centre it, false to align it left

RETURNSCheckboxHandle — the checkbox handle

addRow

from ElementContainer2 overloads
public RowHandle addRow()
public RowHandle addRow(boolean centered)

Adds a left-aligned row at the end and returns its handle, to place elements side by side; see addRow() to centre it.

PARAMETERS

centeredbooleantrue to centre it, false to align it left

RETURNSRowHandle — the row handle, used to add elements to it

Source ↗

addList

from ElementContainer2 overloads
public ListHandle addList(int visibleRows)
public ListHandle addList(int visibleRows, boolean centered)

Adds a left-aligned scrolling list at the end and returns its handle, which holds its lines and selection; see addList() to centre it.

PARAMETERS

visibleRowsintnumber of lines visible at once (at least 1); sets the height
centeredbooleantrue to centre it, false to align it left

RETURNSListHandle — the list handle

Source ↗

addSearch

from ElementContainer2 overloads
public SearchHandle addSearch(Component placeholder)
public SearchHandle addSearch(Component placeholder, boolean centered)

Adds a left-aligned search field at the end and returns its handle, which holds the typed text; see addSearch() to centre it.

PARAMETERS

placeholderComponenthint text, shown while the field is empty
centeredbooleantrue to centre it, false to align it left

RETURNSSearchHandle — the field handle

Source ↗

addProgress

from ElementContainer2 overloads
public ProgressHandle addProgress(Component label)
public ProgressHandle addProgress(Component label, boolean centered)

Adds a left-aligned progress bar at the end and returns its handle, which holds its progress and text; see addProgress() to centre it.

PARAMETERS

labelComponentthe text shown on the bar, or null for none; it also sets the bar width (at least 100 pixels)
centeredbooleantrue to centre it, false to align it left

RETURNSProgressHandle — the bar handle, empty at first

Source ↗
© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.