public class WorkerThread extends Thread
The thread will dispose a dialog if terminated.
The specified Runnable must either monitor whether the thread
got interrupt()ed by checking Thread.isInterrupted()
or override Thread.interrupt() and terminate the thread gracefully.
WorkerDialogThread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
WorkerThread(Runnable worker,
boolean modal,
String title)
Creates a worker thread using an
WorkerDialog. |
WorkerThread(Runnable runnable,
boolean modal,
String title,
JDialog workerDialog)
Creates a worker thread.
|
WorkerThread(Runnable worker,
String title)
Creates a worker thread using a modal
WorkerDialog
and a given title.This is the default case. |
| Modifier and Type | Method and Description |
|---|---|
JDialog |
getWorkerDialog()
Gets the worker dialog.
|
void |
run() |
void |
start() |
void |
startAndWait()
Starts the workerthread and waits until the modal
worker dialog is closed.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldpublic WorkerThread(Runnable runnable, boolean modal, String title, JDialog workerDialog)
runnable - the runnable for this threadmodal - true if dialog should be set to modaltitle - the dialog's title, null if leave unchangedworkerDialog - the dialog that will be disposed when thread terminates,
null if WorkerDialogpublic WorkerThread(Runnable worker, boolean modal, String title)
WorkerDialog.worker - what's to do in the run-method?modal - true if dialog should be set to modaltitle - the dialog's title, null if leave unchangedpublic WorkerThread(Runnable worker, String title)
WorkerDialog
and a given title.worker - what's to do in the run-method?title - the dialog's title, null if leave unchangedpublic JDialog getWorkerDialog()
WorkerDialog)public void run()
Overridden to dispose the dialog.
public void start()
Overridden to show the dialog. The dialog will be shown by invokeLater. This allows the method to return immediately even if the dialog is modal.
public void startAndWait()
Tentackle - distributed, domain- and model-driven