It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes Hand Cursor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Hand Cursor" Watch "Hand Cursor" New topic

Hand Cursor


Joined: Oct 08, 2001
Posts: 7
Our requrement is that whenever mouse is over an image, mouse cursor to be changed to hand cursor.We wrote a programe but couldn't understand as how to use it.
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.awt.Cursor.*;
/* < applet code=test2.class width=320 height=90>
< param name="but2" value="leave1.gif">
< /applet> */
public class test2 extends Applet implements MouseListener
Image imageb2;
int mousex;
int mousey;
public void init()
Cursor c=new Cursor(Cursor.HAND_CURSOR);
String imgname2=getParameter("but2");
public void mouseReleased(MouseEvent me){}
public void mouseClicked(MouseEvent me){}
public void mouseEntered(MouseEvent me)
// System.out.println("X CORDINATE IS "+mousex+" Y CORDINATE IS "+mousey);
public void mouseExited(MouseEvent me){}
public void mousePressed(MouseEvent me)
public void paint(Graphics g)

[This message has been edited by Jim Yingst (edited June 16, 2000).]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
try this:

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: Hand Cursor
It's not a secret anymore!