怎么用线程实现对 Applet 的控制。。
    我想在Applet 中画图片,间隔一点的时间换一张。。
  有点象幻灯片。。

解决方案 »

  1.   

    Timer和TimerTask两个类可以搞定
      

  2.   

    public class PrintMSGThread extends TimerTask {
        public PrintMSGThread() {
        }    public void run() {
            printMSG();
        }    private void printMSG() {
            System.out.println("15秒已到,当前时间是 " + new Date(System.currentTimeMillis()));
        }
    }public class TimerThread {    private Timer timer;    public TimerThread() {
            timer = new Timer();
            timer.schedule(new PrintMSGThread(), 0, 15 * 1000);
        }
    }public class RunTest {
        public RunTest() {
        }    public static void main(String[] args) {
            new TimerThread();
        }
    }