Hi everyone
I have this code:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/* <
APPLET code = "Draw.class" HEIGHT = 300 WIDTH = 300></APPLET> */
public class Draw extends Applet
{
int x;
int y;
String draw="";
public void init()
{
MouseAction ma = new MouseAction();
addMouseMotionListener(ma);
}
public void paint(Graphics g)
{
g.drawString(draw,x,y);
}
public class MouseAction extends MouseMotionAdapter
{
public void mouseMoved(MouseEvent me)
{
x = me.getX();
y = me.getY();
draw = "*";
repaint();
}
}
}
I wanted the * to get drawn (printed) wherever the mouse moves. What i get is the * moves wherever the mouse pointer moves....what am i missing here?...would appreciate your help....Many thanks in advance.