Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to display an houglass cursor?  RSS feed

 
thejaswini ramesh
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I need to change the cursor in my application to an hourglass whenever data is being retrieved during which all mouse events on the application should be disabled.Can someone give me some tips on this??am relatively new to swings...!!!
 
Amol Fuke
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to implement the thread for showing wait cursor.

Inside run method of thread class you can write

setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));

This will display hourglass cursor on the screen.
 
Stephen Boston
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a need to do this as well for methods that took a while, so I came up with these routines.



Just call cursorBusy() before you call your method that takes a while and call cursorNormal() when that method completes.

hth
 
thejaswini ramesh
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Amol and Stephen...did try with setCursor,its working fine...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!