Hello,
I just want to create an app which would create a few threads (number
specified during the execution of main app). In addition I would like
to create JFrame with JProgressBar just to monitor online its execution
(i.e. when I create 5 threads, when first one finished then the
progress bar will go to 20%, after second to 40%, up to 100%). Is it
possible to do it easily in Java??
Regards, mark
Manish Pandit - 21 Nov 2006 01:29 GMT
The quick and easy way to achieve this IMO would be to implement a
lightweight ThreadManager, which every thread registers with upon
instantiation (run), and when it completes, it sends a message
(Callback) to this ThreadManager. That way, at any given point in time
the ThreadManager knows how many threads were spawned, completed, and
are under progress. The progressbar can listen to the ThreadManager via
publish/subscribe and render itself accordingly.
-cheers,
Manish