Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2005

Tip: Looking for answers? Try searching our database.

how to make a working progress bar?

Thread view: 
brightoceanlight@hotmail.com - 11 May 2005 22:23 GMT
Hello,

Could someone explain how to make a working progress bar with
JProgressBar?

I can display it with a fixed value on my GUI, but I can't understand
how to get one working.  I read the Java documentation for JProgressBar
but it doesn't make it any clearer.

Help!

Gil
Roland - 11 May 2005 22:46 GMT
> Hello,
>
[quoted text clipped - 8 lines]
>
> Gil

See
<http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html>

Signature

Regards,

Roland de Ruiter
  ___      ___
 /__/ w_/ /__/
/  \ /_/ /  \

Thomas Weidenfeller - 12 May 2005 08:12 GMT
> Could someone explain how to make a working progress bar with
> JProgressBar?

http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq

Mikael Flensborg - 12 May 2005 08:21 GMT
> Hello,
>
[quoted text clipped - 8 lines]
>
> Gil

Usuallay a Swing Timer is used to poll the object you want to monitor
the progress on and use this value on the progress bar.

class MyProgressObject {

...

  public int getProgress() {
    //Calculate some progress value here
    ...
  }

...

}

Timer ProgressUpdater = new Timer(..) {
  public void actionPerformed(ActionEvent ..) {
    myProgressBar.setValue(myProgressObject.getProgress());
  }
}

Make sure you use a Swing Timer, since the actionPerformed body is then
executed in the EDT..

Hope this is useful

/Mikael
   


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.