アットウィキロゴ

じゃヴぁ0206

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

class game0206 extends Frame implements Runnable{

int t;
int px,py;
int z[][]=new int[6][6];
Image img;

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

game0206(){

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

Thread th=new Thread(this);
th.start();
addWindowListener(new stopwin());
}


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


public void run(){
t=0;
px=10;
py=10;
while(t<100){
repaint();
try{
Thread.sleep(500);
}catch(InterruptedException e){}
t=t+1;  
}
repaint();
}


public void paint(Graphics g){
g.drawImage(img,100+50*px,50+50*py,100,100,this);  
}
}
最終更新:2011年02月05日 18:56