/**
 * class to test out the mouse motion events
 * @author sks2142
 *
 */
import javax.swing.*;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.*;

public class TestMouseMotionEvent {
	/*
	 * frame to display
	 */
	JFrame frame;
	
	/*
	 * Constructor
	 */
	public TestMouseMotionEvent() {
		frame = new JFrame("Test Mouse Motion Event");
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		TestMouseMotionListener listener = new TestMouseMotionListener();
		frame.addMouseMotionListener(listener);
		
		frame.setSize(800, 600);
		frame.setVisible(true);		
	}
	
	public class TestMouseMotionListener extends MouseMotionAdapter {

		@Override
		public void mouseDragged(MouseEvent e) {
			// TODO Auto-generated method stub
			Graphics g = frame.getGraphics();
			g.setColor(Color.RED);
			g.drawRect(e.getX(), e.getY(), 50, 50);
			
		}
		
		
	}
	
	public static void main(String args[]) {
		TestMouseMotionEvent test = new TestMouseMotionEvent();
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

}

