• Post Reply Bookmark Topic Watch Topic
  • New Topic

JProgress bar problem  RSS feed

 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I am presently doing my final year project, a Library software and loads of story behind it! I am presently having a problem, i have a class called application runner that loads bunch of stuff! My problem is that i want the the progress bar to change it's value! This is the code:



That's it! I placed comments where i had problems! I apologise if the code is a bit sloppy ! Pls someone help! I will appreciate it!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see where you've actually displayed the JProgressBar on the screen.

If you look at the loop where you set the values of the progress bar, it's actually going to run very quickly -- perhaps so quickly that you'll never actually see it updated. It's true that you call setVisible(), setLocation(), and setSize() 10,000 times (I'm not clear why -- shouldn't these be outside the loop?) but I suspect the implementations are smart enough to not actually do anything if they're called with the same values twice in succession.

Instead of running 10,000 times, you might want to run 100 times, and sleep for 10 ms at each step, to give the event queue a chance to catch up.

In any case, this isn't advanced Java. We have a Swing/AWT forum for this kind of question, so I'll move this thread there for you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!