This program behaves like the line tool common in drawing programs.
import objectdraw.*;
public class MysteryProgram extends WindowController {
private Line currentLine;
private Location start;
public void onMousePress( Location point )
{
start = point;
currentLine = new Line( point, point, canvas);
}
public void onMouseDrag( Location point )
{
// Erase current line
currentLine.removeFromCanvas();
currentLine = new Line( start, point, canvas);
}
}