import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="MouseMovingPositiononly" width=300 height=100>
</applet>
*/
public class MouseMovingPositiononly extends Applet
{
String msg = "";
int mouseX = 0, mouseY = 0; // coordinates of mouse
public void init()
{
addMouseMotionListener(new Mmadp());
}
// Handle mouse dragged.
private class Mmadp extends MouseMotionAdapter
{
// Handle mouse moved.
public void mouseMoved(MouseEvent me)
{
// save coordinates
mouseX = me.getX();
mouseY = me.getY();
msg ="Mouse moved at\n("+ mouseX+","+mouseY+")";
repaint();
}
}
// Display msg in applet window at current X,Y location.
public void paint(Graphics g)
{
g.drawString(msg, mouseX, mouseY);
}
}