setContent

fun ConstrainedPanel.setContent(parent: CompositionContext? = null, content: @Composable ConstrainedScope.() -> Unit): DisposableHandle

Sets the composable content of this panel as JComponent.setContent does. The content is laid out by the panel's MeasurePolicy and reads ConstrainedScope, so layout modifiers declared at its top level, such as fillMaxWidth, padding or aspectRatio, apply against the panel as they do inside a Layout.

Must be called on the Event Dispatch Thread.

Return

a DisposableHandle that disposes this content composition. Must be disposed on the Event Dispatch Thread.

Parameters

parent

the composition context the content joins, or null for the one the panel's place in the Swing tree resolves to.

content

the composable content of the panel; see ConstrainedScope.