Solved

Change Mouse Pointer in Applet

Posted on 1998-05-21
4
386 Views
Last Modified: 2008-03-03
Anyone knows how to change the mouse pointer in a Java Applet using JDK 1.0? (Using 1.1 is easy).
0
Comment
Question by:pengch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1221324
Frame has a method setCursor in 1.0.2 which you can use to set the cursor for given frame.
              Your applet should create a frame and set its cursor.

              Applet doesnt have any method to set the cursor  in 1.0.2 !!

              Vijay







0
 

Author Comment

by:pengch
ID: 1221325
I want to change the mouse pointer winthin the applet area, not in a frame.
0
 
LVL 2

Accepted Solution

by:
anguslai earned 100 total points
ID: 1221326
the function setCursor() is belongs to Frame Object. In Java Applet, We have to get a
instance of frame object by using getParent() (One of your applet's parent is Frame in an applet), then call the setCursor() as following:
----------------------------------------------------------------------------------------
Object theFrame=null;
   
theFrame=getParent();

 while(!(theFrame instanceof Frame) && theFrame!=null) {
       theFrame=((Component)theFrame).getParent();
 }

if (theFrame!=null) {
           ((Frame)theFrame).setCursor(Frame.HAND_CURSOR);
}
0
 

Author Comment

by:pengch
ID: 1221327
Thanks, that works!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question