Class SwingWorker
Class SwingWorker (in package javax.swing
) perform long-running tasks in a worker thread and to update Swing components from the event dispatch thread based on the tasks’ results. SwingWorker
implements the Runnable
interface, meaning that a SwingWorker object can be scheduled to execute in a separate thread. The SwingWorker
class provides several methods to simplify performing tasks in a worker thread and making the results available for display in a GUI. Some common SwingWorker
methods are described in Fig. J.14. Class SwingWorker
is similar to class AsyncTask
, which is used frequently in Android apps.
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.