This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Show Busy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Show Busy" Watch "Show Busy" New topic

Show Busy

Jill Rains

Joined: Apr 16, 2001
Posts: 4
I have a method that takes several seconds before it returns a value to the user. I would like for the mouse arrow to display as an hour glass to indicate to the user that everything is working. How do I do that?
olivier renard

Joined: Jul 25, 2001
Posts: 2
Try the following code and when you pass your mouse over the frame, the mouse arrow will turn into an hour glass:
import java.awt.* ;
import java.awt.event.* ;
public class AWTCursorTest extends Frame
public AWTCursorTest( String title )
super( title ) ;
public static void main( String args[] )
AWTCursorTest act = new AWTCursorTest( "AWT Cursor Test" ) ;
act.setCursor( new Cursor ( Cursor.WAIT_CURSOR ) ) ;
act.add( new Button ( "A cursor in a busy state!" ) ) ;
new WindowAdapter()
public void windowClosing( WindowEvent we )
System.exit( 0 ) ;
) ;
act.setSize( 300, 300 ) ;
act.setVisible ( true ) ;
Hope this helps
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Check out the java.awt.Cursor class.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: Show Busy
jQuery in Action, 3rd edition