1

I've been looking everywhere and it doesn't appear you can make jprogress bars show decimal values. My problem is I have a program that works with extremely large datasets that take along time to process.

For instance I'm processing a directory which contains over 200k files. It takes on average about 4 minutes to process and input 2000 files into a database which is 1%. I'm trying to give the user a visual indicator as to how much progress has been made on the reading and ingestion of data into the database.

Taking 4 minutes for my progress bar shows 1% leads me to assume that my users might think my program is hung up or broken somewhere.

I know JProgess Bar only accepts integer values. Is there anything else out there that can be used to show progress and represent decimal values.

If my progress bar can show .01% that's better than sitting at 0% for 4 minutes.

If there is no way to do this should I just set my max value as the number of files and not show my progress as a percent?

OlivierLi
  • 2,798
  • 1
  • 23
  • 30
Jeremy
  • 935
  • 5
  • 18
  • 33

1 Answers1

1

The answer is: NO. According to the documentation http://docs.oracle.com/javase/7/docs/api/javax/swing/JProgressBar.html the method setValue accepts only int:

setValue(int n) - Sets the progress bar's current value to n.

You can: 1.) As you said - set the maximum value to the number of documents you have to process.

2.) Use:

setString(String s) - Sets the value of the progress string.

and use it as an indicator of % completed.

3.) Extend the class (?).

Hope that helps.

FazoM
  • 4,777
  • 6
  • 43
  • 61