import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
public class ScreenCapture extends Frame{
Robot r = null;
Window f;
Button b;
Dimension dimScreen;
BufferedImage buffer;
BufferedImage capture;
public ScreenCapture(){
try{
r = new Robot();
}catch(Exception e){
System.err.println(e);
}
b = new Button("Capture");
b.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
captureAll();
}
});
add(b,BorderLayout.SOUTH);
}
public void captureAll(){
this.setVisible(false);
//전체 화면 사이즈 구하기
dimScreen = Toolkit.getDefaultToolkit().getScreenSize();
buffer = r.createScreenCapture(new Rectangle(0,0,dimScreen.width,dimScreen.height));
CaptureImage c = new CaptureImage(buffer);
//윈도우가 생성되지 않았을 경우 생성한다.
if ( f ==