This mystery program draws multiple lines while the user drags the mouse. All the lines share a common endpoint, the location where the user depressed the mouse. The other endpoint is where the mouse is at various points during the drag.
import objectdraw.*;
import java.awt.*;
public class MysteryDrawing extends WindowController {
private Location start;
public void onMousePress( Location point )
{
start = point;
}
public void onMouseDrag( Location point )
{
Line line = new Line( start, point, canvas);
}
}