import java.applet.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class MouseMotionEx extends Applet implements MouseMotionListener
{
int xcord;
int ycord;
public void init()
{
addMouseMotionListener(this);
}
public void paint(Graphics g)
{
g.drawString("("+xcord+","+ycord+")",xcord,ycord);
}
public void mouseMoved(MouseEvent me)
{
xcord=me.getX();
ycord=me.getY();
repaint();
}
public void mouseDragged(MouseEvent me)
{
}
} |
No comments:
Post a Comment