Alex Styl
08/30/2023, 2:50 PMfun takeScreenshot(frame: JFrame) {
val screenshotImage = Robot().createScreenCapture(frame.bounds)
frame.paint(screenshotImage.graphics)
val file = File("screenShot.png")
try {
ImageIO.write(screenshotImage, "png", file)
} catch (ex: IOException) {
ex.printStackTrace()
}
Desktop.getDesktop().open(file)
}
passing this@Window.window
(from a WindowScope). the saved screenshot has the right size but it only has the window's ribbon (with traffic lights on macos) without any of the windows content.
anyone was able to take screenshots on compose desktop?Alexander Maryanovsky
08/30/2023, 6:49 PMAlexander Maryanovsky
08/30/2023, 6:50 PMLandry Norris
08/30/2023, 8:32 PMAlexander Maryanovsky
08/30/2023, 10:23 PMframe.paint(screenshotImage.graphics)
?Alexander Maryanovsky
08/30/2023, 10:24 PMval screenshotImage = Robot().createScreenCapture(frame.bounds)
Alex Styl
09/01/2023, 4:32 AM