|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.denova.ui.SwingWorker
SwingWorker is a class to make using Swing thread safe. * * This is based on what appears to be the last version of * SwingWorker that does not require generics. * Since we still support Java 1.4, this is important. * We've changed the identifiers to largely match the * identifiers used in the Java 6 version of SwingWorker. * Hopefully this will make a later migration to SwingWorker in * Java 6 easier. Don't change anything that makes this * class incompatible with Java 6 SwingWorker unless it's really * necessary. This version also checks for Swing thread * violations using SwingCheckerThread. * * To use this class: *
| Field Summary | |
static int |
DONE
DONE: immediately after done() is finished. |
static int |
PENDING
PENDING: when SwingWorker's constructor instantiated. |
static int |
STARTED
STARTED: immediately before doInBackground() has started. |
| Constructor Summary | |
SwingWorker()
Start a thread that will call the doInBackground method
* and then exit. |
|
| Method Summary | |
abstract java.lang.Object |
doInBackground()
Do time consuming non Swing work in background. |
void |
done()
Called on the event dispatching thread, not on the worker thread, * after the doInBackground method has returned. |
void |
execute()
Start the worker thread. |
java.lang.Object |
get()
Return the value created by the doInBackground method. |
int |
getState()
Set the current state of SwingWorker. |
protected java.lang.Object |
getValue()
* Get the value produced by the worker thread, or null if * doInBackground isn't finished yet. |
void |
interrupt()
Interrupt the doInBackground() thread. |
boolean |
isDone()
Determine if SwingWorker is finished. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PENDING
public static final int STARTED
public static final int DONE
| Constructor Detail |
public SwingWorker()
doInBackground method
* and then exit.
| Method Detail |
protected java.lang.Object getValue()
public abstract java.lang.Object doInBackground()
get method.
* Do not access Swing from this method unless the Swing method
* is documented in its javadocs as thread safe.
*
* This method is called on this thread.
public void done()
doInBackground method has returned.
* You can access Swing in this method. Do not do anything that
* takes more than a very short time.
public final int getState()
public final boolean isDone()
public void interrupt()
public java.lang.Object get()
doInBackground method.
* Returns null if either the thread running doInBackground or the current
* thread was interrupted before a value was produced.
*
* @return the value created by the doInBackground method
public void execute()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||