import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
class anime04 extends Frame implements Runnable{
Frame f;
Thread th;
int nx;
public static void main(String[] args){
Frame f=new anime04();
f.setSize(300,300);
f.setBackground(Color.yellow);
f.show();
}
anime04() {
addWindowListener(
new stopwin());
nx=1;
th=new Thread(this);
th.start();
}
class stopwin extends WindowAdapter{
public void windowClosing(WindowEvent we){System.exit(0);}
}
public void paint( Graphics g ) {
int n;
for (n=1;n<10;n++){
System.out.println(nx);
g.setColor(Color.red);
g.drawLine(20,20,
100,100);
g.drawRect(100,100,50,50);
nx=nx+1;
}
}
public void update(Graphics g) {
paint(g);
}
public void run() {
int i;
repaint();
try{th.sleep(1000);} catch(InterruptedException e) { }
}
}
最終更新:2010年09月18日 13:26