Solved

Change Mouse Pointer in Applet

Posted on 1998-05-21
4
381 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
backtracking recursion  code 19 53
session migration servlets 2 24
javap bin 2 26
Oracle SQL syntax check  without executing 6 31
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now