Salve ragazzi, su internet ho trovato la seguente classe
Avviandola tramite il prompt dei comandi fa uno screenshot al desktop e lo salva i formato jpg.codice:import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.awt.Dimension; import java.awt.*; import javax.imageio.ImageIO; public class RobotExp { public static void main(String[] args) { 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 bi=robot.createScreenCapture(new Rectangle(800,800)); ImageIO.write(bi, "jpg", new File("graphics1.jpg")); } catch (AWTException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
Ho provato a far partire questa classe da un applet che ho creato ma non ci riesco in nessun modo...
Consigli?

					
					
					
						
  Rispondi quotando