// Figure 12.19:  MousePainter.java
// D&D's application turned into an applet
// Demos MouseMotionAdapter class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MousePainter extends JApplet {
	private int xValue, yValue;

	public void init( ) {
		xValue = -10;
		yValue = -10;

		addMouseMotionListener( 
			new MouseMotionAdapter( ) {
				public void mouseDragged( MouseEvent e ) {
					xValue = e.getX( );
					yValue = e.getY( );
					repaint( );
				}
			}
		);
	}

	public void paint( Graphics g ) {
		g.setColor( Color.red );
		g.fillOval( xValue, yValue, 100, 20 );
	}
}