アットウィキロゴ

じゃヴぁg0116

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

class game0116 extends Frame implements Runnable{

int t;
int x,y;
int m,n;
int map[][]=new int[501][501];

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

game0116(){


for (m=0;m<501;m++){
for(n=0;n<501;n++){
map[m][n]=1;
}
}

for (m=50;m<451;m++){
for(n=50;n<451;n++){
map[m][n]=2;
}
}

for (m=100;m<400;m++){
for(n=100;n<400;n++){
map[m][n]=3;
}
}

x=260;
y=100;


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=1;  
while(t<100){

repaint();
try{
Thread.sleep(1000);
}catch(InterruptedException e){}
t=t+1;  
}
repaint();
}


public void paint(Graphics g){

for (m=0;m<501;m++){
for(n=0;n<501;n++){
g.setColor(Color.red);
if(map[m][n]==1)g.fillRect(100+n,600-m,1,1);
g.setColor(Color.black);
if(map[m][n]==2)g.fillRect(100+n,600-m,1,1);
g.setColor(Color.green);
if(map[m][n]==3)g.fillRect(100+n,600-m,1,1);

}
}

}
}
最終更新:2011年02月07日 15:36