I have this code for taking a screenshot; how could I change it to take and buffer a screenshot every second?
{
BufferedImage image = robot.createScreenCapture(rectangle);
search: for(int x = 0; x < rectangle.getWidth(); x++)
{
for(int y = 0; y < rectangle.getHeight(); y++)
{
}
}
}
You could (amongst other things) use the Timer API in the JDK, for example:
Timer t = new Timer("Sceenshot timer");
TimerTask screenShotTask = new TimerTask() {
@Override
public void run() {
// Call your code
}
};
t.schedule(screenShotTask, 1000);