定时器
有一个java.utils.Timer   不知道是不是你要的

解决方案 »

  1.   

    如果是做Swing等UI界面,
    建议用javax.swing.Timer
    如果是普通应用,
    建议用java.util.Timer
      

  2.   

    我写了一个,运行看看。
    import java.util.*;
    import javax.swing.*;public class FrameScheduler{
    public static void main(String args[]){
    java.util.Timer timer = new java.util.Timer();
    try{
    timer.schedule(new TimerTask(){
    public void run(){
    JOptionPane.showMessageDialog(null, "hello", "hello", JOptionPane.INFORMATION_MESSAGE); 
    }
    },1000,1000);
    }catch(IllegalArgumentException  e){
    System.err.println(e);
    }catch(IllegalStateException e){
    System.err.println(e);
    }catch(Exception e){
    System.err.println(e);
    }
    }
    }