Jprogressbar not updating

Posted by / 23-Aug-2017 20:01

Jprogressbar not updating

Now that we've identified the problem, how do we fix it?The answer in your case will depend on your program requirements and your comfort level with threads.

Ideally you'd update your Bulk Processor in the do In Background method of the Swing Worker, and that would call set Progress, and the j Progress Bar would be listening for those progress updates as in the example.Basically, you mustn't access the UI from a non-UI thread, and you mustn't do long-running work on a UI thread.See the Swing concurrency tutorial for more information.The local variable percent Complete in the update thread remains at 100, and does not update as it does the first run.I tested the percent Complete variable from the Bulk Processor class, and this variable does in fact update as expected. So what I have done is set percent Complete = 0; when the process button is clicked (before the Threads are called), and printed the values of percent Complete before and after percent Complete = Bulk Percent Complete() in my update() thread.

jprogressbar not updating-70jprogressbar not updating-10jprogressbar not updating-38

So for some reason the thread is not fetching the update values using Bulk Percent Complete() the second time the thread is called. The result is percent Complete will be 0 before Bulk Percent Complete() is called, and jump right back to 100 after.

One thought on “jprogressbar not updating”