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 wait cursor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "wait cursor" Watch "wait cursor" New topic

wait cursor

Sabina Norderhaug

Joined: Oct 29, 2003
Posts: 6
I have wait cursor set in action_Performed as:

/** Sets cursor for specified component to Wait cursor */
public static void startWaitCursor(JComponent component) {
RootPaneContainer root =
/** Sets cursor for specified component to normal cursor */
public static void stopWaitCursor(JComponent component) {
RootPaneContainer root =

When I click the button, I see default wait cursor (sandglass) no probelm. But if I move mouse outside this frame and then move it back, cursor changes to one of the resize cursor, so it looks like either horizontal or vertical 2 point arrow.
I wonder why this is happening and how can I avoid it?
Thank you,
Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 327
This question was passed to the Swing/AWT forum where it was closed because the question already existed in this forum. Circle with no answers. Not very helpful. The bartender in the forum the message was passed to closed the message because it was a duplicate of the message that was passed to that forum. How about an answer?
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Actually, this code works fine... the actual problem is that the event thread is being blocked in some way, which keeps the cursor from changing back to what it's supposed to be after the native frame changes it to the resize cursor. Try the code below, then comment out the new thread being launched in the ActionListener (and leave the contents of the run() inside the actionPerformed()) and you will see the same behavior.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: wait cursor
It's not a secret anymore!