wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "wait cursor" Watch "wait cursor" New topic
Author

wait cursor

Sabina Norderhaug
Greenhorn

Joined: Oct 29, 2003
Posts: 6
I have wait cursor set in action_Performed as:
mLoginDialog.startWaitCursor(mLoginDialog.getRootPane());
where

/** Sets cursor for specified component to Wait cursor */
public static void startWaitCursor(JComponent component) {
RootPaneContainer root =
(RootPaneContainer)component.getTopLevelAncestor();
root.getGlassPane().setCursor(WAIT_CURSOR);
root.getGlassPane().setVisible(true);
}
/** Sets cursor for specified component to normal cursor */
public static void stopWaitCursor(JComponent component) {
RootPaneContainer root =
(RootPaneContainer)component.getTopLevelAncestor();
root.getGlassPane().setCursor(DEFAULT_CURSOR);
root.getGlassPane().setVisible(false);
}

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,
Sabina
Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 319
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
Bartender

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.



-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: wait cursor
 
Similar Threads
Set Wait Cursor
unable to change the cursor to string.
NX: Server GUI
wait cursor question
Cursor