Progress bar to show the progress of a task

C

Charlie Zhang

In my application one click on the start button will fire one specific
task which includes some numerical computation routines and data
visualization routines.

Want to use progress bar to show the progress of the task execution,
even after reading sun's java swing tutorials still not clear how to
set the maximum length of the progress bar and update the progress
status.

Really appreciate your time and kind help!

Thanks a lot.
 
L

Liz

Charlie Zhang said:
In my application one click on the start button will fire one specific
task which includes some numerical computation routines and data
visualization routines.

Want to use progress bar to show the progress of the task execution,
even after reading sun's java swing tutorials still not clear how to
set the maximum length of the progress bar and update the progress
status.

Really appreciate your time and kind help!

Thanks a lot.

Only your application can know how long the task is going to be.
If you are reading a file, for example, you can map the file size
to 100% and the current position in the file divided by the file
size to be the current completion percent. If you just want to know
how to set the value: setProgress(50); will set it to 50%
 
C

Charlie Zhang

Only your application can know how long the task is going to be.
If you are reading a file, for example, you can map the file size
to 100% and the current position in the file divided by the file
size to be the current completion percent. If you just want to know
how to set the value: setProgress(50); will set it to 50%

Thanks a lot, but actually the task associated with that button is
complicated and hard to estimate the whole work load. Maybe I shall
consider other swing feature to just show that the computer is busy.
Is cursor a good
choice?

Thanks so much.
 
P

Paul Lutus

Charlie said:
Thanks a lot, but actually the task associated with that button is
complicated and hard to estimate the whole work load.

Translation: "I cannot determine in advance a total count, but I want to
show task progress." Is this correct? If so:

JProgressBar.setIndeterminate

public void setIndeterminate(boolean newValue)

Sets the indeterminate property of the progress bar, which determines
whether the progress bar is in determinate or indeterminate mode. An
indeterminate progress bar continuously displays animation indicating that
an operation of unknown length is occurring. By default, this property is
false. Some look and feels might not support indeterminate progress bars;
they will ignore this property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top