How to change cursor in an applet

I must change cursors shape to HAND_CURSOR in an applet with no frame. Is this possible and how?

Thanx in advance.
ComaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sen_kumCommented:
import java.awt.* ;
public class Test extends java.applet.Applet
{
    public void init()
    {
        setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ;
    }
}
0
ComaAuthor Commented:
I get compiler error J0049: Undefined name 'setCursor'
0
vladi21Commented:
u use java 1.0?

set cursor to applet's frame

{
    public void init()
    {
       
     Component c = this.getParent();
     while (c!=null && !(c instanceof Frame))
         c=c.getParent();

((Frame)c).setCursor(...


also u can try make menu in applet :)

13) How do you get a Menubar/Menu in an applet?
 In your applet's init() method, create a Frame instance and then attach the Menus, Menubar etc to that frame. You cannot attach the Menu or a Menubar to an applet directly.
Or get the parent Frame like this (doesn't work in all execution environments):

    Container parent = getParent();
    while (! (parent instanceof Frame) )
        parent = parent.getParent();
    Frame theFrame = (Frame) parent;
This second suggestion definitely doesn't work in the appletviewer, and probably won't work on Macs (where would the Menubar go?) or in some browsers. In JDK 1.1, just use a popup menu, which isn't attached to a Frame.
0
shaveriCommented:
Try the foll..in your code...

import java.awt.*;
import java.applet.*;

public class cursor extends Applet {
    public void init() {
        Object frame = getParent ();
        while (! (frame instanceof Frame))
            frame = ((Component) frame).getParent ();
           ((Frame) frame).setCursor (Frame.HAND_CURSOR);

        }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vladi21Commented:
shaveri - its not good...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.