?
Solved

Progress Bar

Posted on 2003-02-19
5
Medium Priority
?
271 Views
Last Modified: 2010-03-31
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.
0
Comment
Question by:Wateryboy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:jerelw
ID: 7981868
What is your task?

...If you do a select count(*) before displaying your records in a resultset,etc...
0
 
LVL 2

Accepted Solution

by:
Mark Roberts earned 40 total points
ID: 7982215
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
 

Expert Comment

by:CleanupPing
ID: 9059240
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
 
LVL 2

Expert Comment

by:Mark Roberts
ID: 9070650
I'm assuming my answer solved this unless I hear otherwise.
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 9553010
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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question