and another question. can i "easily" make a compos...
# compose-desktop
z
and another question. can i "easily" make a composable item that shows an image to fullscreen (like F11 does usually) and make it stop fullscreen mode with ESC key?
and can i then do this with a SwingPanel aswell?
d
You can control WindowPlacement:
Copy code
fun main() = application {
    val windowState = rememberWindowState()

    Window(
        onCloseRequest = ::exitApplication,
        state = windowState,
        onKeyEvent = {
            when (it.key) {
                Key.F11 -> {
                    windowState.placement = WindowPlacement.Fullscreen
                    true
                }
                Key.Escape -> {
                    windowState.placement = WindowPlacement.Floating
                    true
                }
                else -> false
            }
        }
    ) {
        Button(onClick = {
            windowState.placement = when(windowState.placement) {
                WindowPlacement.Fullscreen -> WindowPlacement.Floating
                else -> WindowPlacement.Fullscreen
            }
        }) {
            Text("Change window mode")
        }
    }
}
z
ok but that works only for the window? not fir a single component?
d
I tested it on MacOS