I have a program written in JAVA that creates a JPG file at a specified path whenever PRINTSCREEN is pressed. This program runs in background and uses the JIntellitype API.
My problem is that:
screensize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
is the only available function I could find to get the screen size which I later use to get a buffered image like this:
bf = screenRobot.createScreenCapture(screensize);
where bf
is a BufferedImage
data type.
Is there any way that I could get the screensize of the window that is currently active so that unwanted content is not saved in the JPG file?