An Applet with Mouse Motion Events


The applet's real estate is the area within the border

Source

AnAppletWithMouseMotion.java:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class AnAppletWithMouseMotion extends Applet implements MouseMotionListener {
    public void init() {
        addMouseMotionListener(this);
		}

    public void mouseDragged(MouseEvent e) {
        System.out.println("mouse is being dragged at location (" + e.getX() + ", " + e.getY() + ")");
    }
    public void mouseMoved(MouseEvent e) {
        System.out.println("mouse is being moved at location (" + e.getX() + ", " + e.getY() + ")");
		}
}

Notes

Working with Mouse Motion

This Applet's Behavior

Things to Do

API work Playing With the Applet
Place the following applets on the same page: