TableContentScope
The receiver of a Table's content, through which it configures the parts the table builds itself.
A JTable builds its header itself; Header configures it. An if/else can select its declaration while keeping the same header:
Table(rows = people, columns = { column("Name") { it.name } }) {
if (compact) {
Header(modifier = SwingModifier.background(surface), reorderingAllowed = false)
} else {
Header(modifier = SwingModifier.background(surfaceVariant))
}
}Content copied to clipboard
A table holds nothing besides its parts, so a child that declares none of them is refused, naming the table and the calls that would place it. Each part is declared once: two Headers are refused too. A part whose declaration goes away gets back the values its declaration replaced.
See also
Functions
Link copied to clipboard
@Composable
Configures the table's own header, the JTableHeader that shows the column titles. The header stands where the table puts it: in the column header of the scroll pane whose viewport shows the table.