Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make a "working" icon appear during long process 1

Status
Not open for further replies.

bos

Technical User
Oct 1, 2002
50
US
I'm working on an interface which at one point will write up to 10,000 lines to a file. It takes awhile and a user might think the system has locked up. Is there a way to have an animation with a working message appear when the process starts and then close when it stops? If so what is an example of how to do it?

Thanks in advance.
 
In cases like this, unless it is imperative that the system block while this activity is going on, you might want to run this heavy activity in another thread.

Alternately, you can do the following:

// Assumes that 'this' is a container like the parent frame
this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

// Do your stuff here

this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));

 
can you choose a specific graphic to use as the cursor image?
 
I don't believe so. You can use any graphics that are installed as system cursors but not just any graphic. There are several different cursors available as int constants. Check out the Cursor class API in swing for all of the details.
 
What about a ProgressBar? I don't know much about them because I've never had to use one, but I'm sure I stumbled across them in the API once...maybe someone can elaborate?
 
Exactly. I would recommend a JProgressBar for such a task. It lets the user know that activity is taking place. ------
KJR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top