• Post Reply Bookmark Topic Watch Topic
  • New Topic

Set the cursor  RSS feed

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have a front end application that has JButtons on it.
Each of the JButtons is set up to launch another application (each having their own main method). I would like the cursor to be set to WAIT while the app being launched is loading. Then set back to DEFAULT.
At what point do I set the cursor back to default?
I am setting it to WAIT after the button is pushed.
In each of the classes that can be launched from the front end app, do I set the cursor back to DEFAULT at the end of the main() method?
If so, how?

I tried writing a static method in the front end app that sets the default and wait cursor, but I couldn't get it to compile because it wouldn't let me use the setCursor method in a static context.
Any suggestions?
Thanks!
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever application sets the cursor should reset it. So the "launcher" application should be in charge of the managing the cursor, and the other classes shouldn't need to know about the cursor.
The simple case is to have the "launcher" (1) save the current cursor, (2) set the cursor to WAIT, (3) call the appropriate method of whatever class is being invoked, and (4) restore the cursor when step #3 completes.
If the calls aren't multi-threaded then you can simply restore the cursor after the call. If the calls are multi-threaded then you have to have some type of communication mechanism to be notified when the call is complete.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, so I'm setting the Cursor in the app that launches other apps.
I set the cursor to WAIT once the user launches an application.
Then the following code runs:

The cursor is set back immediately after the line of code runs to start the launched app.
How do I determine when the new app is completely done loading?
Also, am I launching the app correctly?
Thanks again for your help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!