diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/SwingPanel.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/SwingPanel.desktop.kt index de44524ea243a..6dba5db86c7e0 100644 --- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/SwingPanel.desktop.kt +++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/awt/SwingPanel.desktop.kt @@ -183,7 +183,7 @@ public fun SwingPanel( * @param key The unique identifier for the panel container. * @param focusComponent The component that should receive focus. */ -private class SwingPanelContainer( +internal class SwingPanelContainer( key: Int, private val focusComponent: Component ): JPanel() { diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.desktop.kt index e30313c4ea670..926c289b6c33d 100644 --- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.desktop.kt +++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.desktop.kt @@ -23,6 +23,7 @@ import androidx.compose.ui.ComposeFeatureFlags import androidx.compose.ui.awt.AwtEventListener import androidx.compose.ui.awt.OnlyValidPrimaryMouseButtonFilter import androidx.compose.ui.awt.SwingInteropContainer +import androidx.compose.ui.awt.SwingPanelContainer import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.focus.FocusManager import androidx.compose.ui.geometry.Offset @@ -155,6 +156,10 @@ internal class ComposeSceneMediator( override fun componentAdded(e: ContainerEvent) { val component = e.child + if (component !is SwingPanelContainer) { + // It means that some external component was added to [ComposePanel] + return + } if (useInteropBlending) { // In case of interop blending, compose might draw content above this [component]. // But due to implementation of [JLayeredPane]'s lightweight/heavyweight mixing