public class ThreadUtils extends Object
Constructor and Description |
---|
ThreadUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
invokeAndWait(Runnable runnable)
Runs a
Runnable , synchronously, on the event dispatch thread (EDT). |
static void |
invokeAndWaitHandled(Runnable runnable)
Convenience method that handles the exceptions thrown by
invokeAndWait(Runnable) . |
public static void invokeAndWait(Runnable runnable) throws InvocationTargetException, InterruptedException
Runnable
, synchronously, on the event dispatch thread (EDT).
Behaves exactly like EventQueue.invokeAndWait(Runnable)
, but can be called from
that thread as well.
If the View
is not initialised the runnable is executed in the current thread.
runnable
- the Runnable
to be run in the EDT.InterruptedException
- if the current thread was interrupted while waiting for the EDT.InvocationTargetException
- if an exception occurred while running the Runnable
in the EDT.public static void invokeAndWaitHandled(Runnable runnable)
invokeAndWait(Runnable)
.
The InvocationTargetException
is logged as an error and the InterruptedException
as warning.
runnable
- the Runnable
to be run in the EDT.