• Post Reply Bookmark Topic Watch Topic
  • New Topic

setCursor in JApplet ???

 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello --
I have a JApplet that I want to set the cursor to the hourglass at certain points, like when the applet is being initialized and when I am performing database calls.
Here is some of my code:
[code]
public class MyApplet extends JApplet
{
private void setCursorBusy(boolean isBusy)
{
if (isBusy)
{
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Toolkit.getDefaultToolkit().sync();
}
else
{
this.setCursor(Cursor.getDefaultCursor());
Toolkit.getDefaultToolkit().sync();
}
}
My problem is that the above code is not being recognized. It runs, but the cursor stays the default cursor the entire time. I saw some posts saying that I should obtain the glassPane on the JFrame, but this is an applet - there is no glassPane available. Surely someone has encountered this on their applet. How do I change the cursor for the entire applet??
Thanks for your help!
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Verduka,
This has always worked for me:

Regards,
Manfred.
 
verduka fox
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manfred,
Thanks for the suggestion. I tried it, and it seems to work ONLY if I keep the cursor on the applet for the duration of the operation. If I move the cursor off of the applet and then back on the applet, the cursor returns to the default cursor even though the operation is not yet complete. While this is better than before, I need the cursor to remain as the WAIT_CURSOR until my database call is complete. Do you know of a solution which will keep the cursor as specified until the operation is complete, even if the user leaves the applet and returns? Thanks in advance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!