Public Member Functions | |
| abstract 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. | |
| void | interrupt () |
| A new method that interrupts the worker thread. | |
| Object | get () |
| Return the value created by the construct method. | |
| SwingWorker () | |
| Start a thread that will call the construct method and then exit. | |
| void | start () |
| Start the worker thread. | |
Protected Member Functions | |
| synchronized Object | getValue () |
| Get the value produced by the worker thread, or null if it hasn't been constructed yet. | |
Protected Attributes | |
| ThreadVar | threadVar |
| 12-8-2004 (LEM) - made this protected so I could have access to it in the children | |
Private Member Functions | |
| synchronized void | setValue (Object x) |
| Set the value produced by worker thread. | |
Private Attributes | |
| Object | value |
| see getValue(), setValue() | |
Classes | |
| class | ThreadVar |
| Class to maintain reference to current worker thread under separate synchronization control. More... | |
For instructions on and examples of using this class, see:
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
Note that the API changed slightly in the 3rd version: You must now invoke start() on the SwingWorker after creating it.
I (LEM) downloaded this from the Java tutorial. This allows me to do some minor multi-threading.
| javawrapper.SwingWorker.SwingWorker | ( | ) |
Start a thread that will call the construct method and then exit.
| synchronized Object javawrapper.SwingWorker.getValue | ( | ) | [protected] |
Get the value produced by the worker thread, or null if it hasn't been constructed yet.
| synchronized void javawrapper.SwingWorker.setValue | ( | Object | x | ) | [private] |
Set the value produced by worker thread.
| x | Value produced by worker thread |
| abstract Object javawrapper.SwingWorker.construct | ( | ) | [pure virtual] |
Compute the value to be returned by the get method.
| void javawrapper.SwingWorker.finished | ( | ) |
Called on the event dispatching thread (not on the worker thread) after the construct method has returned.
| void javawrapper.SwingWorker.interrupt | ( | ) |
A new method that interrupts the worker thread.
Call this method to force the worker to stop what it's doing.
| Object javawrapper.SwingWorker.get | ( | ) |
Return the value created by the construct method.
Returns null if either the constructing thread or the current thread was interrupted before a value was produced.
| void javawrapper.SwingWorker.start | ( | ) |
Start the worker thread.
Object javawrapper.SwingWorker.value [private] |
see getValue(), setValue()
ThreadVar javawrapper.SwingWorker.threadVar [protected] |
12-8-2004 (LEM) - made this protected so I could have access to it in the children
1.5.2