I have a custom JDialog that pops up when my SwingWorker thread fires up. The dialog just has a JProgressbar and a Button (cancel button). I am trying to figure out how to c
You should call
worker.cancel(true); //this will set the cancel flag of the worker
worker.cancel(true);
Then, when you invoke isCancelled() this will return true. So, you Can check this state in your loop
isCancelled()
true