Sisi lo avevo provato, ma mi da comunque
variable JFrame non trovata.
Io il JFrame l'ho dichiarato in un altra classe
codice:
class CaricaImmagini extends JFrame {
public CaricaImmagini(){
super("GT5 Event Maker");
setBounds(0, 0, 600, 730);
setVisible(true);
}
}
E la classe RobotExp che viene richiamata tramite il click su un bottone.
codice:
public class RobotExp {
public static void screen() {
try {
Robot robot = new Robot();
// Capture the screen shot of the area of the screen defined by the rectangle
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
BufferedImage image =
new Robot().createScreenCapture(JFrame.getBounds());
ImageIO.write(bi, "jpg", new File("graphics1.jpg"));
} catch (AWTException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Non capisco dove sbaglio, scusate ancora se vi faccio perdere tempo con la mia incompetenza.