Bob Lawson wrote:Well, I thought it was exactly what I wanted. But now it turns out that it must run as a new thread, rather than run under the current thread as above. How would you do that?
What do you mean? What has to run as a new thread? The run() method can run on any given thread (assuming the class is a Runnable). The thread which wants to cancel the task needs to have access to the same object and calls the cancelWidgets() method, but can also be called from any thread (presumably not the same one as does the processing).