?
Solved

Changing mouse cursor in applet

Posted on 1997-11-19
3
Medium Priority
?
331 Views
Last Modified: 2008-02-26
I need to change the mouse cursor into the hand-cursor if the user moves the mouse over a specific area of my applet. I want to do the same as a html link would do. Show the "hand-cursor" over a link to signialize click-me. Is this possible in Java? Thanks.
0
Comment
Question by:Duebel
[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
3 Comments
 
LVL 4

Accepted Solution

by:
russgold earned 320 total points
ID: 1230965
This is fairly straightforward in JDK 1.1, where you can use the setCursor() method to associate a cursor with a component. Java will automatically switch to that cursor when you move the mouse over the component.

Since you ask about applets, however, I suspect that you need a JDK 1.02 solution, which is a bit more elaborate. You need to find the Frame which encloses your component and explicitly set the cursor as needed in a mouse handler.

For an example, check out my applet (with source code) at:

http://www.netaxs.com/~russgold/java_samples/dragTest.html

If you move the mouse over a basketball, the cursor will change to a crosshair.  It will change to a hand when you click and drag a basketball to the hoop.

The code that does this is found in the DragSurface class.
0
 
LVL 4

Expert Comment

by:russgold
ID: 1230966
I should mention that, on Windows platforms, the hand cursor is an arrow pointing straight up; on Mac and Unix it is actually a hand.
0
 

Author Comment

by:Duebel
ID: 1230967
Thanks a lot
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 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