Class SwingWorker
java.lang.Object
|
+--SwingWorker
- Direct Known Subclasses:
- ArrayControlCommand, ControllerConfigCommand, ExposureCommand, ManualCommand, PciTimUtilCommand, SetupCommand
- abstract class SwingWorker
- extends java.lang.Object
An abstract class that you subclass to perform
GUI-related work in a dedicated thread.
For instructions on using this class, see
http://java.sun.com/products/jfc/swingdoc/threads.html
This version has an extra method called interrupt()
,
see the Example1 class below for more information.
Field Summary |
protected boolean |
abort
|
private java.lang.Thread |
thread
|
private java.lang.Object |
value
|
Constructor Summary |
SwingWorker()
Modified to do nothing. |
Method Summary |
boolean |
alive()
Check if the current thread is alive. |
abstract java.lang.Object |
construct()
Compute 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. |
java.lang.Object |
get()
Return the value created by the construct method. |
void |
interrupt()
A new method that interrupts the worker thread. |
void |
stop()
Abort the current thread. |
void |
thread_it()
Start a thread that will call the construct method
and then exit. |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
value
private java.lang.Object value
thread
private volatile java.lang.Thread thread
abort
protected boolean abort
SwingWorker
public SwingWorker()
- Modified to do nothing. To start the thread, the subclass must
call the "thread_it" method.
construct
public abstract java.lang.Object construct()
- Compute the value to be returned by the
get
method.
finished
public void finished()
- Called on the event dispatching thread (not on the worker thread)
after the
construct
method has returned.
alive
public boolean alive()
- Check if the current thread is alive.
stop
public void stop()
- Abort the current thread.
interrupt
public void interrupt()
- A new method that interrupts the worker thread. Call this method
to force the worker to abort what it's doing.
get
public java.lang.Object get()
- Return the value created by the
construct
method.
thread_it
public void thread_it()
- Start a thread that will call the
construct
method
and then exit.