Card
Holds the children as a deck of cards of which exactly one is shown. The deck asks for room enough for its largest card, so showing another card does not resize it.
Each child names the card it is placed on through CardPanelScope, and selectedCard picks the card the deck shows:
Panel(PanelLayout.Card(selectedCard = page)) {
Label(text = "Welcome", modifier = SwingModifier.card("welcome"))
Label(text = "Details", modifier = SwingModifier.card("details"))
}A card holds a single child; two children naming the same card are reported as an error on the event dispatch thread once the change pass that caused it has settled, so a pass that replaces a card's occupant need not take the outgoing child out before the incoming one arrives. The report reaches whatever handles an uncaught exception on that thread - by default the JDK's, which prints it and moves on, so an application that installs none of its own keeps running with both children on the card.
Dropping a child (e.g. behind an if) takes its card with it, and a selectedCard matching no card leaves the card currently on top showing. A child that names no card is placed on the deck's empty-named card, which an empty selectedCard shows; that card holds a single child like any other, so two children naming none are refused the way a card named twice is.
See also
Constructors
Properties
Functions
Lays the container out under this layout. An implementation makes one write on updater through installManager.