Skip to content

GaldurPanelLayout

classclient onlysince 0.1.0

com.galdurstudio.galdurui.api.layout.GaldurPanelLayout

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
PACKAGEapi.layout
SIDEclient only
EXTENDSAbstractLayout

Constructors 1

GaldurPanelLayout

public GaldurPanelLayout(LayoutElement child)

PARAMETERS

childLayoutElementpanel contents, usually a LinearLayout

Methods 5

padding

public GaldurPanelLayout padding(int padding)

Fixes the padding instead of following the theme.

PARAMETERS

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

RETURNSGaldurPanelLayout — this layout

THROWSIllegalArgumentException — if padding is negative

useThemePadding

public GaldurPanelLayout useThemePadding()

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

RETURNSGaldurPanelLayout — this layout

withSprite

public GaldurPanelLayout withSprite(ResourceLocation sprite)

Replaces the background sprite.

PARAMETERS

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

RETURNSGaldurPanelLayout — this layout

getPadding

public int getPadding()

RETURNSint — the effective padding, in GUI pixels

getChild

public LayoutElement getChild()

RETURNSLayoutElement — the element inside the panel

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