In this code, the JProgressBar is not getting updated because of the napkin look and feel. When I change the look and feel to system look and feel, it works fine. Please help.
Are you better than me? Then please show me my mistakes..
Thanks for the reply. My original application will not use either timers or threads. So, I completely removed the thread and tested. Still no good . Please help
Michael Dunn
Rancher
Joined: Jun 09, 2003
Posts: 4041
posted
2
What is a progressbar without a thread or a timer?
Michael Dunn wrote:What is a progressbar without a thread or a timer?
errr, anyway, is that is a MUST to use either thread or Timer? But my progressbar has to show the workload done, so things like Thread.sleep(1000) like things cannot be applied.
Your progress bar needs to show the workload, true, but how do you update it? Do you perform all the processing from an actionPerformed event or any other event on the EDT? If so, then this will block the EDT and therefore will let only the last progress bar value be shown.
Rob Spoor wrote:Your progress bar needs to show the workload, true, but how do you update it? Do you perform all the processing from an actionPerformed event or any other event on the EDT? If so, then this will block the EDT and therefore will let only the last progress bar value be shown.
err, this is not much clear to me, so I am posting my code with the edits I have mentioned
I can use a timer as you have mentioned, but, according to this code, is it necessary? And, won't it be a performance hit, because if I can do all the operations within 5 seconds, the Thread or Timer will take time to sleep..Please make this clear to me, honestly, this is the first time I am using JProgressBar.
OK..I copied a code from the internet to test the timer, and adjusted the napkin look and feel. But unfortunatly that is also not working. The code is below
This look and feel is a trouble maker anyway. So, is there any way to change the look and feel of the progressbar? I mean JUST the progress bar to System look and feel while all other components are napkin. Please help
Michael Dunn
Rancher
Joined: Jun 09, 2003
Posts: 4041
posted
0
just tested the code in the recent post, and it does actually work.
problem seems to be the napkin l&f paints everything the same color,
the text, the backround, the 'progress' etc - so you don't see any change.
try adding these lines immediately after the indicated line
if you get it working, then change to whatever colors you want
Michael Dunn wrote:just tested the code in the recent post, and it does actually work.
problem seems to be the napkin l&f paints everything the same color,
the text, the backround, the 'progress' etc - so you don't see any change.
try adding these lines immediately after the indicated line
if you get it working, then change to whatever colors you want
wow, yeah!! It worked Michael!!! Thanks a lot for the help!!! That was great!!
Rob Spoor wrote:Your progress bar needs to show the workload, true, but how do you update it? Do you perform all the processing from an actionPerformed event or any other event on the EDT? If so, then this will block the EDT and therefore will let only the last progress bar value be shown.
Thanks a lot for the idea about the Timer, Rob!! Now I can stop, start, restart, and pause the workload!!! Amazing!!!