Example #1
0
 /**
  * ** Place the Runnable object in the current EventQueue execution stack to be executed after the
  * ** specified initial delay. ** @param delayMillis The number of milliseconds to wait befor
  * executing the specified Runnable. ** This method will still return immediately. ** @param r The
  * Runnable instance to execute (ie. call the "run()" method)
  */
 public static void invokeDelayed(int delayMillis, final Runnable r) {
   if (r != null) {
     if (delayMillis <= 0) {
       MethodAction.invokeLater(r);
     } else {
       javax.swing.Timer delay =
           new javax.swing.Timer(
               delayMillis,
               new ActionListener() {
                 public void actionPerformed(ActionEvent ae) {
                   r.run();
                 }
               });
       delay.setRepeats(false);
       delay.start();
     }
   }
 }
Example #2
0
 /**
  * ** Place this MethodAction object in the current EventQueue execution stack to be executed
  * after the ** specified initial delay. ** @param delayMillis The number of milliseconds to wait
  * befor executing this MethodAction. ** This method will still return immediately.
  */
 public void invokeDelayed(int delayMillis) {
   javax.swing.Timer delay = new javax.swing.Timer(delayMillis, this);
   delay.setRepeats(false);
   delay.start();
 }