|
Re: I want to export all the instructions contained in the main in a proced
|
Posted: Apr 11, 2006 4:23 AM
|
|
Please format your code, google: "Java Tutorial Methods"
Sounds like a newbie request, unless I have misunderstood it. In the mean time here is what you seemed to be looking for:
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
class ScreenCapture {
public static void main(String args[]) {
ScreenCapture capt = new ScreenCapture();
capt.captureScreen();
}
public void captureScreen()throws AWTException, IOException{
BufferedImage screencapture = new Robot().createScreenCapture(
new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()) );
// Save as JPEG
File file = new File("screencapture.jpg");
ImageIO.write(screencapture, "jpg", file);
}
}
|
|