Wednesday, August 17, 2011

MouseMotionListener

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*


*/

public class motion1 extends Applet implements MouseMotionListener
{
int x,y;

public void init()
{
addMouseMotionListener(this);
}

public void mouseDragged(MouseEvent me)
{
}

public void mouseMoved(MouseEvent me)
{

x=me.getX();
y=me.getY();
repaint();
}

public void paint(Graphics g)
{
g.fillOval(50,50,x,y);
}
}


No comments:

Post a Comment