个人觉得不大可能!因为要调用操作系统底层的控制!
用JNI调用WIN的API也许可以,不过没试过!

解决方案 »

  1.   

    用Timer.
    详见http://www.csdn.net/Expert/topic/498/498599.shtm
      

  2.   

    import javax.swing.Timer.*;ActionListener myAL;
    Timer MyTimer;
    int internal=1000;   //你要的时间间隔myAL=new ActionListener(){
           public void actionPerformed(ActionEvent e){
             此处为你要运行的程序
           }
        };
    MyTimer=new Timer(internal,myAL);MyTimer.start();
      

  3.   

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.Timer.*;
    public class Test extends JPanel{
      ActionListener myAL;
      Timer MyTimer;
      int internal=1000;  //你要的时间间隔
      int myout=0;
      int m=1;
      int d=0;
      Container panel=this;
      JPanel panel1=new JPanel(new BorderLayout());
      JLabel label=new JLabel();  public Test(){
          add(panel1);
          panel1.add(label);
          myAL=new ActionListener(){
          public void actionPerformed(ActionEvent e){
            MyTimer.stop();
            if(myout<50)run();
          }
        };
        MyTimer=new Timer(internal,myAL);
        run();
      }  void run(){
        myout+=2;
        label.setText(String.valueOf(myout));
        MyTimer.start();
      }  public static void main(String args[]){
      JFrame f=new JFrame("MYTEST");
        Test mytest=new Test();
        f.getContentPane().add(mytest);
        f.setSize(300,300);
        f.show();
        f.addWindowListener(new WindowAdapter(){
              public void windowClosing(WindowEvent e){
                System.exit(0);}
        });
      }
    }