アットウィキロゴ

写真の利用

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

class game extends Frame{

Image img;

public static void main(String [] args) {
        Frame f=new game();
        f.setTitle("game");
        f.setSize(700,700);
        f.setBackground(Color.yellow);
        f.setVisible(true);
    }

game(){

img = Toolkit.getDefaultToolkit().getImage("100.jpg");


addWindowListener(new stopwin());
}


class stopwin extends WindowAdapter{
    public void windowClosing(WindowEvent we){System.exit(0);}
}  


public void paint(Graphics g){

int m,n;
int[] x=new int[5];
int[] y=new int[5];

x[1]=0;
y[1]=0;
x[2]=350;
y[2]=0;
x[3]=0;
y[3]=350;
x[4]=350;
y[4]=350;

for(m=1;m<5;m++){
g.drawImage(img,x[m],y[m],350,350,this);  
}


}

}
最終更新:2011年07月12日 13:40