给楼主帖一个timer的例子,渴望一点分。我快两个三角了,请楼主快揭贴:)import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer; 
// to resolve conflict with java.util.Timerpublic class TimerTest
{  
   public static void main(String[] args)
   {  
      ActionListener listener = new TimePrinter();      // construct a timer that calls the listener
      // once every 10 seconds
      Timer t = new Timer(10000, listener);
      t.start();      JOptionPane.showMessageDialog(null, "Quit program?");
      System.exit(0);
   }
}class TimePrinter implements ActionListener
{  
   public void actionPerformed(ActionEvent event)
   {  
      Date now = new Date();
      System.out.println("At the tone, the time is " + now);
      Toolkit.getDefaultToolkit().beep();
   }
}