Á°¤ÎÆü / ¼¡¤ÎÆü / ºÇ¿· / 2001-10

¤¿¤Þ¤Ë¤Ã¤­¡£ / 2001-10-27

2001-10
Æü·î²Ð¿åÌÚ¶âÅÚ
123456
78910111213
14151617181920
21222324252627
28293031

2001-10-27 Sat

¢£ ¥Õ¥ì¡¼¥à¤Î¥­¥ã¥×¥Á¥ã

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

class FrameCapture extends Frame{
    public FrameCapture(){
        Button capture = new Button("Capture");
        setLayout(new FlowLayout());
        add(capture);
        capture.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                try{
                    Image img = new BufferedImage(getWidth(), getHeight(), 
                                                  BufferedImage.TYPE_INT_ARGB);
                    Graphics g = img.getGraphics();

                    paint(g);

                    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(new FileOutputStream("aaa.jpg"));
                    encoder.encode(img);
                } catch(Exception e){
                    e.printStackTrace();
                }
            }
        });
    }

    public void update(Graphics g){
        paint(g);
    }

    public static void main(String[] args){
        FrameCapture f = new FrameCapture();
        f.setSize(400, 400);
        f.setVisible(true);
        Graphics g = f.getGraphics();

        g.drawLine(0, 0, 100, 200);
        g.drawRect(10, 20, 200, 150);
    }
}


¤³¤ó¤Ê¤ó¤ÇÂç¾æÉפΤϤº

Category: [Java]

2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12
2003 : 01 02 03 04 05 06 07 08 09 10 11 12
2002 : 01 02 03 04 05 06 07 08 09 10 11 12
2001 : 01 02 03 04 05 06 07 08 09 10 11 12

ºÇ½ª¹¹¿·»þ´Ö: 2008-09-04 19:19

Á°¤ÎÆü / ¼¡¤ÎÆü / ºÇ¿· / 2001-10

¥«¥Æ¥´¥ê