• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JProgress bar problem

 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic