Hi,
I am trying to make a progress monitor bar for a long execution. The program is basically trying to scan the local network (which takes about two minutes). I have a result class which prepares a JPanel that can be placed in the UI with the results. I want to have a neat progress bar for the whole process. I did make a ProgressMonitor object with a Task class and PropertyChangeListener as of the example in:
http://download.oracle.com/javase/tutorial/uiswing/components/progress.html
http://download.oracle.com/javase/tutorial/uiswing/examples/components/ProgressMonitorDemoProject/src/components/ProgressMonitorDemo.java
so currently it is like a fake progress bar which just based on the
thread sleep time. Currently my approach is create another thread in action listener class that runs the result class but for some reason I can't call back the JPanel object from asynchronously.... I tried to used the ExecutorService with FutureTask but not sure whether I am using it the right way.
A general flowchart of my current app is like
UI-->scan button-->at actionlistener for scan button creation of the swingworker for task and executorservice
||1*|| is what i what to run parallel to the progress monitor
in the above code the scan button gets clicked and stays enabled until the scan is done but the progress monitor bar never shows up.
removing ||1*|| just shows up the progress bar but ofcourse the scan never took place.
ANY HELP IN CORRECT WAY OF SETTING IT UP or USE OF A DIFFERENT APPROACH WOULD BE GREATLY APPRECIATED!!