Michal Harakal
08/02/2021, 1:51 PMBig Chungus
08/02/2021, 3:11 PMMichal Harakal
08/02/2021, 3:59 PMval panel = AppManager.focusedWindow!!.window
val bufImage = BufferedImage(panel.getSize().width, panel.getSize().height,BufferedImage.TYPE_INT_RGB);
panel.paint(bufImage.createGraphics());
val imageFile = File("."+File.separator + "image.jpeg");
try{
imageFile.createNewFile();
ImageIO.write(bufImage, "jpeg", imageFile);
}catch(ex:Exception){
}
Problem is a time point when to take the screenshot. I have tested with WindowEvents:onFocusGet but apparently windows is not composed yet, the image is empty. I have to figure out how to trigger screenshot after composition. I will go with cheap delay first ….Igor Demin
08/02/2021, 5:24 PMMichal Harakal
08/02/2021, 6:19 PM