Question

This question already has an answer here:

Is there a way to pause/resume the SwingWorker in Java ?

Was it helpful?

Solution

You can pause the task you run in the swing worker by implementing something like this

while(true) {
   if(paused)
   {
       try {
           Thread.sleep(500); // half a second
           continue;
       } catch(InterruptedException e)
       {
       }
   }
}

It is not very nice though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top