|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.pacbell.jfai.toh.util.AbstractSwingWorker
public abstract class AbstractSwingWorker
Subclasses perform GUI-related work in a dedicated thread. For instructions on using this class, see Swing tutorial
| Constructor Summary | |
|---|---|
AbstractSwingWorker()
Creates a thread that will call construct()followed by
finished()and then exits. |
|
| Method Summary | |
|---|---|
abstract Object |
construct()
Computes the value to be returned by the get()method. |
void |
finished()
Called on the event dispatching thread (not on the worker thread) after the construct()method has returned. |
Object |
get()
Returns the value created by the construct()method. |
protected net.pacbell.jfai.toh.util.AbstractSwingWorker.ThreadVar |
getThreadVar()
Gets the synchronization instance. |
protected Object |
getValue()
Gets the value produced by the worker thread, or null if it hasn't been constructed yet. |
void |
interrupt()
Interrupts the worker thread. |
static void |
invokeAndWait(Runnable runner)
Guarantees that the argument is executed by the event dispatch thread while the caller is blocked. |
static void |
invokeLater(Runnable runner)
Guarantees that the argument is executed by the event dispatch thread. |
protected void |
setThreadVar(net.pacbell.jfai.toh.util.AbstractSwingWorker.ThreadVar threadVar)
Sets the synchronization instance. |
protected void |
setValue(Object x)
Sets the value produced by the worker thread. |
static void |
showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType)
Displays a dialog and waits until the dialog is closed. |
void |
start()
Starts the worker thread. |
void |
started()
Called on the event dispatching thread (not on the worker thread) before the construct()method is called. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractSwingWorker()
construct()followed by
finished()and then exits.
| Method Detail |
|---|
public static void invokeAndWait(Runnable runner)
throws InterruptedException,
InvocationTargetException
Note that if the Runnable.run() method throws an uncaught
exception it is caught and re-thrown as an
InvocationTargetExceptionin the callers thread.
runner - a Runnable
InterruptedException - if the worker thread is interrupted
InvocationTargetException - if an uncaught exception occurs in the
worker threadpublic static void invokeLater(Runnable runner)
runner - a Runnable
public static void showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType)
parentComponent - the parent component of the dialogmessage - a messagetitle - the dialog titlemessageType - the dialog typeJOptionPane.showMessageDialog(java.awt.Component, java.lang.Object,
java.lang.String, int)public abstract Object construct()
get()method.
public void finished()
construct()method has returned. By default, does nothing.
public Object get()
construct()method. Returns
null if either the constructing thread or the current thread was
interrupted before a value was produced.
public void interrupt()
public void start()
invokeAndWait(Runnable),
started()public void started()
construct()method is called. By default, does nothing.
protected net.pacbell.jfai.toh.util.AbstractSwingWorker.ThreadVar getThreadVar()
protected Object getValue()
protected void setThreadVar(net.pacbell.jfai.toh.util.AbstractSwingWorker.ThreadVar threadVar)
threadVar - the threadVar to set for synchronized access to the
worker threadprotected void setValue(Object x)
x - the value object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||