Progress Bar

I am trying to implement a progress bar in my program.

Firstly, how do you center a frame(the progress bar) on the screen?

I tried frame.setLocationRelativeTo(null); //(taken from the java sun site)

But this was not recognised.

Also anyone any idea of how to calculate the length of the task because at the moment I am cheating by hard coding a fixed time.

I am using the SwingWorker class.

Thanks.
WateryboyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Mark RobertsConnect With a Mentor Incident ManagerCommented:
frame.setLocationRelativeTo(null);  is only available in version 1.4 according to the JavaDoc.

As far as determining the timing for the task, most don't try to guess at the total time it is a percentage of the work to be done.  Example:  if you have 1000 records to process every 10 records becomes 1 percent of the task.  Obviously if you do different things with each record each 10 records may not take the same amount of time but your progress would show that 1 percent of the "task" had been completed.

0
 
jerelwCommented:
What is your task?

...If you do a select count(*) before displaying your records in a resultset,etc...
0
 
CleanupPingCommented:
Wateryboy:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
Mark RobertsIncident ManagerCommented:
I'm assuming my answer solved this unless I hear otherwise.
0
 
tomboshellCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: MARoberts
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thomas Boshell
EE Cleanup Volunteer
0
All Courses

From novice to tech pro — start learning today.