Class InvokeInSwingTask

  • All Implemented Interfaces:
    MonitoredRunnable

    public class InvokeInSwingTask
    extends Task
    A task that will simply invoke the given runnable later in the Swing thread. This class is useful for executing long running tasks in the swing thread while using the TaskLauncher to show a modal dialog.
    • Constructor Detail

      • InvokeInSwingTask

        public InvokeInSwingTask​(java.lang.String title,
                                 java.lang.Runnable runnable)
    • Method Detail

      • run

        public void run​(TaskMonitor monitor)
        Description copied from class: Task
        This is the method that will be called to do the work

        Note: The run(TaskMonitor) method should not make any calls directly on Swing components, as these calls are not thread safe. Place Swing calls in a Runnable, then call SystemUtilities.runSwingLater(Runnable) or SystemUtilities.runSwingNow(Runnable)to schedule the Runnable inside of the AWT Event Thread.

        Specified by:
        run in class Task
        Parameters:
        monitor - The TaskMonitor that will monitor the executing Task