Applet中paint()方法的使用问题
import java.awt.*;
import java.applet.*;
public class Test2 extends Applet
{ private static final long serialVersionUID = 1L;
int i=0;
public void paint(Graphics g)
{ i=(i+2)%360;
Color c=new Color((3*i)%255,(7*i)%255,(11*i)%255);
g.setColor(c);
g.fillArc(30, 50, 120, 100, i, 2) ;//1
g.fillArc(30, 152, 120, 100, i, 2);//2
try{Thread.sleep(500);}catch(InterruptedException e){}
repaint();
}
public void updata(Graphics g)
{g.clearRect(30, 152, 120, 100);
paint(g);
}
}
上面的小程序,当我重写父类Component的updata(Graphics g)方法时,每次调用repaint()方法时自动调用updata方法,清除了//2所画的弧,为什么//1处的弧也被清除了,怎样实现//1处逐渐
形成一个椭圆?
------解决方案--------------------
updata() 是个什么东西 !!!