Aller au contenu
galdurdocs

GaldurPanelLayout

classclient uniquementdepuis 0.1.0

com.galdurstudio.galdurui.api.layout.GaldurPanelLayout

Pas encore traduit : texte d’origine en anglais.

Layout that wraps a child in a themed background panel. Its size is the child's plus the padding on every side, and the 9-slice background follows its final position and size. Combined with the vanilla layouts, screens need no coordinate maths:

Example.java
LinearLayout column = LinearLayout.vertical().spacing(GaldurTheme.gap());// ... column.addChild(...)GaldurPanelLayout panel = new GaldurPanelLayout(column);addRenderableOnly(panel);                     // first, so the background is drawn behindpanel.visitWidgets(this::addRenderableWidget);panel.arrangeElements();FrameLayout.centerInRectangle(panel, getRectangle());

Unless padding() is set, the padding is read from the theme (spacing.panel_padding) on every arrangeElements().

public class GaldurPanelLayout extends AbstractLayout implements Renderable
PAQUETapi.layout
CÔTÉclient uniquement
HÉRITE DEAbstractLayout

Constructeurs 1

GaldurPanelLayout

public GaldurPanelLayout(LayoutElement child)

PARAMÈTRES

childLayoutElementpanel contents, usually a LinearLayout

Méthodes 5

padding

public GaldurPanelLayout padding(int padding)

Fixes the padding instead of following the theme.

PARAMÈTRES

paddingintspace between the panel edge and the child, in GUI pixels

RENVOIEGaldurPanelLayout — this layout

EXCEPTIONSIllegalArgumentException — if padding is negative

useThemePadding

public GaldurPanelLayout useThemePadding()

Goes back to the theme padding (spacing.panel_padding).

RENVOIEGaldurPanelLayout — this layout

withSprite

public GaldurPanelLayout withSprite(ResourceLocation sprite)

Replaces the background sprite.

PARAMÈTRES

spriteResourceLocationGUI sprite id, ideally a grayscale 9-slice (tinted by the theme)

RENVOIEGaldurPanelLayout — this layout

getPadding

public int getPadding()

RENVOIEint — the effective padding, in GUI pixels

getChild

public LayoutElement getChild()

RENVOIELayoutElement — the element inside the panel

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyProduit non officiel. Non approuvé par Mojang ou Microsoft, ni associé à eux.