Ignor Warneengs
07/27/2021, 5:24 PMIgor Demin
07/27/2021, 5:36 PMimport androidx.compose.material.Text
import androidx.compose.ui.awt.ComposeWindow
import java.awt.Dimension
import java.awt.GraphicsDevice
import java.awt.GraphicsEnvironment
import javax.swing.JFrame
import javax.swing.SwingUtilities
fun main() = SwingUtilities.invokeLater {
val window = ComposeWindow()
window.size = Dimension(200, 200)
window.setContent {
Text("Text")
}
window.moveToScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices[1])
window.isVisible = true
}
fun ComposeWindow.moveToScreen(device: GraphicsDevice) {
val dummy = JFrame(device.defaultConfiguration)
setLocationRelativeTo(dummy)
dummy.dispose()
}
Michael Paus
07/27/2021, 7:20 PM