GridBag
Places each child in the grid cell that child's own constraints describe - the row and column it starts at, the cells it spans, its share of the leftover extent, and how it fills the cell it is given.
A child names its cell with item, through GridBagPanelScope:
Panel(PanelLayout.GridBag) {
Label(text = "Name", modifier = SwingModifier.item(gridx = 0, gridy = 0))
Button(
text = "Pick",
onClick = ::pick,
modifier = SwingModifier.item(gridx = 1, gridy = 0, weightx = 1.0, fill = GridBagConstraints.HORIZONTAL),
)
}Content copied to clipboard
A child that declares no item is laid out under GridBagConstraints' own defaults.
Constraints are reactive: changing a child's arguments re-places it, and dropping the child (e.g. behind an if) removes it.
See also
Functions
Link copied to clipboard
Lays the container out under this layout. An implementation makes one write on updater through installManager.