アットウィキロゴ

j1005

import java.awt.*;
import java.awt.event.*;    // For event
import java.io.*;           // For File
import java.awt.image.*;    // For BufferedImage
import javax.imageio.*;     // For ImageIO

public class game1005 extends Frame {
    BufferedImage bimg;
    
public static void main(String[] args) {
        game1005 f = new game1005();
        f.setBounds(100,100,300,300);
        f.setVisible(true);
}    
    
game1005() {
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
}            
});        
        try {
            File imgfile = new File("harada.jpg");  //  ファイルオブジェクト作成
            bimg = ImageIO.read(imgfile);     //  読みだす
        } catch (Exception e) { }

try {
     File imgfile2 = new File("outfile.jpg");  //  ファイルオブジェクト
     ImageIO.write(bimg, "jpg", imgfile2);     //  書きだす
} catch (Exception e) {}

}  

public void paint(Graphics g) {
        g.drawImage(bimg,50,50,this);
}    
}
最終更新:2011年03月06日 00:57