/** * ** Queues the invocation of the specified ActionListener on the EventQueue ** @param al The * ActionListener to execute ** @param ae The ActionEvent to pass to the ActionListener */ public static void invokeLater(final ActionListener al, final ActionEvent ae) { MethodAction.invokeLater( new Runnable() { public void run() { al.actionPerformed(ae); } }); }
/** * ** 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(); } } }
/** * ** Queues the invocation of this MethodAction on the EventQueue, and waits for the EventQueue */ public void invokeAndWait() throws InterruptedException, InvocationTargetException { MethodAction.invokeAndWait(this); }
/** ** Queues the invocation of this MethodAction on the EventQueue */ public void invokeLater() { MethodAction.invokeLater(this); }