ColumnScope

sealed interface ColumnScope

The receiver of a Column's content, through which a child declares its own placement in that column.

Children are written plainly; what a child declares here rides along on its modifier:

Column {
Label(text = "Title")
FlowPanel(modifier = SwingModifier.weight(1f)) { Body() }
Button(text = "Close", onClick = ::close, modifier = SwingModifier.align(Alignment.End))
}

Functions

Link copied to clipboard

Places the child at alignment across the column's width, in place of the column's own horizontalAlignment.

Link copied to clipboard

Gives the child the column's whole width in place of the width it prefers, up to an explicit maximumSize where it declares one. A child taking the whole width has nowhere left to sit, so this stands in for both its own align and the column's horizontalAlignment.

Link copied to clipboard
abstract fun SwingModifier.weight(weight: Float, fill: Boolean = true): SwingModifier

Claims weight shares of the height the column has left over once every child that claims none has taken the height it prefers. Two children weighted 1f and 2f take a third and two thirds of it. A child with an explicit maximumSize takes no more than that maximum allows; what it leaves stays empty. With fill the child occupies all the height it is granted; otherwise it occupies as much of that height as it prefers and the column's arrangement places the rest.