下面是java源代码:
/*
<applet code="Animate.class" width=300 height=300>
</applet>
*/
import java.awt.*;
import java.applet.Applet;
public class Animate extends Applet
{
private static int NIMAGES=5;
private static int MILLISECS=200;
private Image image[]=new Image[NIMAGES];
private int imageN=0;
public void init()
{
showStatus("Loading image files. please wait");
for(int k=0;k<image.length;k++)
image[k]=getImage(getDocumentBase(),"spider"+k+"gif");
}
public void paint(Graphics g)
{
g.drawImage(image[imageN],20,20,this);
imageN=(imageN+1)%NIMAGES;
delay(MILLISECS);
repaint();
}
private void delay(int n)
{
try
{
Thread.sleep(n);
}
catch(InterruptedException e)
{
System.out.println(e.toString());
}
}
}
我把图像文件放在和源文件一个目录下,启动后没有什么显示?
怎么没有显示图像?