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");
imageb2=getImage(getDocumentBase(),imgname2);
addMouseListener(this);
}
public void mouseReleased(MouseEvent me){}
public void mouseClicked(MouseEvent me){}
public void mouseEntered(MouseEvent me)
{
mousex=me.getX();
mousey=me.getY();
// System.out.println("X CORDINATE IS "+mousex+" Y CORDINATE IS "+mousey);
if((mousex>12)&(mousex<94)&(mousey>9)&(mousey<33))
{
System.out.println("Hello");
}
}
public void mouseExited(MouseEvent me){}
public void mousePressed(MouseEvent me)
{}
public void paint(Graphics g)
{
g.drawImage(imageb2,10,10,this);
}
}
[This message has been edited by Jim Yingst (edited June 16, 2000).]