Old SwingWorker
Home ] Up ] [ Old SwingWorker ] An Old SwingWorker Example ] New SwingWorker ] A New SwingWorker Example ]

 

 

Sun has a very useful set of articles on thread usage with Swing:

They introduce a useful class called SwingWorker, which provides some very useful features:

  • SwingWorker is an abstract class which you can extend in your own subclass to add useful functionality.
  • It allows you to compute a value in a new thread.
  • Your subclass will override the construct() method, within which the value will be computed (in the new thread)
  • Your subclass can override the finished() method, which is automatically invoked in the event thread at the end of the work performed in computing the value.
  • The work performed by a SwingWorker can be interrupted

This version of the SwingWorker class is not part of the Java distribution (and will not be), but it can be downloaded from the above web pages.

 
The page was last updated February 19, 2008