LayeredPane

@Composable
fun LayeredPane(modifier: SwingModifier = SwingModifier, style: SwingStyle<ContainerStyleScope> = SwingStyle, content: @Composable LayeredPaneScope.() -> Unit)

A container that stacks its content on integer depth layers rather than laying it out, realized as a JLayeredPane.

A child declares the depth it sits on with layer, through LayeredPaneScope; a child declaring none stands on JLayeredPane.DEFAULT_LAYER. Within one layer, the children stack in the order the composition declares them, the first of them on top. A layered pane lays no child out, so each child positions itself with bounds(...) in its style:

LayeredPane {
Background(style = { bounds(0, 0, 400, 300) })
FloatingToolbar(modifier = SwingModifier.layer(JLayeredPane.PALETTE_LAYER), style = { bounds(8, 8, 120, 32) })
}

Adding or removing a child in the composition adds or removes it on the pane, and a child moves to the layer it declares on recomposition.

Parameters

modifier

the SwingModifier applied to the underlying JLayeredPane

style

the SwingStyle applied to the underlying JLayeredPane

content

the composable content of the pane; see LayeredPaneScope

See also