# Java Progress Bar Not Showing Progress



## systemErr (Apr 18, 2008)

I'm writing a java program that uses a JProgressBar. My program performs inserts on a database and the progress bar keeps track of this by showing a percentage of the task being completed. My problem is that when I run "long" tasks, say a couple minutes, the progress-bar doesn't show any progress. The inserts are performed on the database, but no indication of progress is made via the progress-bar. However, for shorter tasks, the progress-bar shows progress just fine. 

Any ideas what causes this?


----------



## ShosMeister (Jan 19, 2008)

Some sample code of how you are implementing the progress bar would be helpful. My guess is that it's not getting time to update unless it's run in a separate thread.


----------



## v1_0 (Dec 8, 2008)

One thing to think about: if your database transactions take a different amount of time each, then your progress is just 'number of transactions' as opposed to 'time'.

Is it possible that your first transaction is taking a very long time (perhaps things are getting cached, or you are doing a select), and all your other transactions are very quick? In that case, your status bar will sit for a while (as no transactions are completed) then 'jump' to done as your 2-n transactions get done quickly.


----------

