File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes hwo to use system cursors like the hourglass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "hwo to use system cursors like the hourglass" Watch "hwo to use system cursors like the hourglass" New topic

hwo to use system cursors like the hourglass

Jay Mistry

Joined: May 19, 2001
Posts: 16
how can I use the system cursors in my java swing application, plus when I click on a button or menu item it sticks around until the next window is ready to be displayed and it goes away right before the window opens - how do I stop this and use the hourglass or some other system cursor to let the user know that something is happening?
thank you very much

[This message has been edited by Jay Mistry (edited May 24, 2001).]
Deepal Mehta

Joined: May 28, 2001
Posts: 6
As soon as the procedure starts use
& at the end use
Edward Liu

Joined: May 29, 2001
Posts: 2
The prior code, while functional, is deprecated. The following will compile in Java 1.3 without warnings:
Note that these calls simply change the cursor shape, however. This does NOTHING to lock out mouse or key actions. I imagine you could do that by setting a "state" variable in the class and then adding stuff to mouse and key listeners that ignore input if the state variable is set. There has to be a better way to tell Java that a Swing component is busy, but it seems nicely buried amongst all the other stuff Swing does, and none of the texts I've ever seen seem to talk about how to do that.
-- Ed
Colleen Casey

Joined: Apr 24, 2001
Posts: 9
To lock out all keyboard events, you will need to set the glasspane.

You can do this with:

JComponent gp = (JComponent) getGlassPane();

To turn off the glasspane, just reset the cursor to default and set visible to false.
I agree. Here's the link:
subject: hwo to use system cursors like the hourglass
It's not a secret anymore!