Hiya,
My question pertains to multi-threading in Java. I'm translating an app I wrote in Visual Basic 2008 into Java. There is a class in VB called BackgroundWorker, which allows the coder to perform a task on another thread, a lot like SwingWorker
in Java. The only distinct difference is that, with the BackgroundWorker
thread is run()
, it fires an event called DoWork()
on the mainline which contains the code to execute in the background. Furthermore, after the code has executed, a RunWorkerCompleted()
event is fired back on the foreground thread to interpret results.
I have found the BackgroundWorker
setup quite useful and it seems a little more flexible than SwingWorker
and I was just wondering whether it was possible (and acceptable) to fire events in the same way in Java? And if so, how would I go about it? Since I've only done a quick scan over SwingWorker
, it's possible that it has a similar functionality that would work just as well, in which case I would be happy to know about that instead.
Cheers,
Hoopla