I have a small issue that I don’t really know how to solve, basically I want to take a screenshot (using the "Robot" class) of my desktop excluding the actual program GUI components. Originally I believed it can be done by temporary hiding the components but every time a new screenshot is made the components are included in the image.
This is the block included in the actionPerformed method for the button that takes the screenshot:
if (command.equals("zoom")) {
setComponentVisability(false);//try to hide the components from the robot
zt.screenShoot();//take the screenshot
setComponentVisability(true);//show the components
}
"zt.screenShoot" takes the screenshot and returns it in a new JFrame (for debugging),in my main frame I am using the
com.sun.awt.AWTUtilities.setWindowOpaque(systemWindow, false);
method to make the background transparent; not sure if that has anything to do with this issue.
any help would be great, thanks