填空题
小应用程序运行结果如下图:红色方块在文字上从左向右循环移动。
import java.applet.*;
import java.awt.*;
public class Class3004 extends Applet
{
int i=1;
public void______{setBackground(Color.yellow);}
public void paint(Graphics g)
{
i+=8;if(i>160)i=1;
g.______;
g.fillRect(i,10,20,20);
g.drawstring("我正在学习Java绘图!",1,25);
try{Thread.sleep(100);}
catch(InterruptedException e){}
repaint();
}
}
【参考答案】
init()或者start()
setColor(Color.red)