• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

wait cursor

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic