Skip to content

VBox

Vertical linear container stacking children top-to-bottom with uniform spacing.

Overview

VBox is a vertical shorthand for LinearBox. It arranges child widgets from top to bottom using flex layout (FlexDirection.COLUMN) without line wrapping.

Spacing between adjacent elements is configured with spacing(pixels) and updates rowGap. Individual children can request flex expansion via child.layout(s -> s.expand()).

Vertical Form Layout

VBox form = new VBox().spacing(10.0f);
form.addChild(new Label("Username"));
form.addChild(new TextField());
form.addChild(new Label("Password"));
form.addChild(new PasswordField());

API

VBox()

Constructor

Creates an empty vertical linear container.