アットウィキロゴ

がめ0219

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

class game0219 extends Frame implements Runnable{

int t;
Font fo;
int x1,x2,x3;  

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

game0219(){



x1=400;
x2=500;
x3=600;

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<200){
t=t+1;

x1=x1-50;
x2=x2-100;
x3=x3-200;
if(x1<100)x1=100;
if(x2<100)x2=100;
if(x3<100)x3=100;

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


public void paint(Graphics g){

fo=new Font("TimesRoman",Font.PLAIN,45);
g.setFont(fo);
g.setColor(Color.blue);
g.drawString("Computational",x1,100);
g.drawString("Economic ",x2,200);
g.drawString("Research",x3,300);
}

}
最終更新:2011年02月15日 05:12