Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show Busy

 
Jill Rains
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!" ) ) ;
act.addWindowListener(
new WindowAdapter()
{
public void windowClosing( WindowEvent we )
{
System.exit( 0 ) ;
}
}
) ;
act.setSize( 300, 300 ) ;
act.setVisible ( true ) ;
}
}
Hope this helps
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the java.awt.Cursor class.
Bosun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic