结构推理 编写一个实际的动画程序。
【正确答案】import java.awt.*; import java.applet.*; import java.awt.event.*; public class ActiveImages extends Applet implements Runnable,ActionListener { Image iImages[]; //图像数组 Thread aThread; int iFrame; //图像数组下标 int sleeptime; //参数,线程sleep时间 String graphfile; //图片文件名 int graphcount; //图片张数 AudioClip au; //定义一个声音对象 Button b1,b2; public void init() { int i,j; iFrame=0; aThread=null; sleeptime=Integer.parseInt(getParameter("sleeptime")); graphfile = getParameter("graphfile"); graphcount = Integer.parseInt(getParameter("graphcount")); iImages = new Image[graphcount]; String fname = graphfile; j = fname.indexOf("."); for (i=0;i
【答案解析】