Draw something where the mouse clicks
Need to save mouse coords somewhere, then repaint()
Note previous drawing will be erased automatically
Keep all the items you have drawn
Optional: Use a cooler data structure
import java.util.*;
...
ArrayList<Point> points = new ArrayList<Point>();
...
points.add (event.getPoint());
repaint ();
...
for (Point p : points) {
g.draw (something at p.x, p.y)
}
Optional: Draw a path that follows mouse dragging
requires MouseMotionListener
Usually also your own state variable to remember if mouse is up or down
Or could use mouseDragged vs mouseMoved