List of utility methods to do Swing UI Thread Event
Thread | doLater(final long milliseconds, final Runnable doThis) Schedule something to occur at some specified point in the future in the Swing Event thread. Thread thread = new Thread(new Runnable() { public void run() { try { Thread.sleep(milliseconds); SwingUtilities.invokeAndWait(doThis); } catch (InterruptedException e) { } catch (java.lang.reflect.InvocationTargetException e) { }); thread.start(); return thread; |
void | doLaterOnEventThread(Runnable task) Schedule a task for later execution on the even dispatch thread and return immediately. SwingUtilities.invokeLater(task); |
void | doOnEventThreadAndWait(Runnable task) Execute a task on the even dispatch thread and wait for it to finish. if (SwingUtilities.isEventDispatchThread()) { task.run(); } else { try { SwingUtilities.invokeAndWait(task); } catch (InterruptedException e) { throw new RuntimeException( "Thread interrupted while waiting for task to execute on event dispatch thread", e); ... |
void | doSwing(Runnable r) do Swing if (SwingUtilities.isEventDispatchThread()) { r.run(); } else { try { SwingUtilities.invokeAndWait(r); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (InterruptedException e) { ... |
Executor | edtExecutor() edt Executor return EDT_EXECUTOR;
|
void | edtInvokeLater(Runnable block) edt Invoke Later SwingUtilities.invokeLater(block); |
void | edtSmartInvokeAndWait(Runnable block) edt Smart Invoke And Wait if (!SwingUtilities.isEventDispatchThread()) try { SwingUtilities.invokeAndWait(block); } catch (InterruptedException e) { } catch (InvocationTargetException e) { else block.run(); ... |
void | execute(Runnable command) Sends a Runnable to the EDT for the execution. SwingUtilities.invokeLater(command); |
void | executeInSwingThread(final Runnable code) Execute code in swing thread only. if (SwingUtilities.isEventDispatchThread()) { code.run(); } else { SwingUtilities.invokeLater(code); |
void | executeRunnable(Runnable runnable) execute Runnable executeRunnable(runnable, true); |