class Freehand { /* Class for freehand drawing */ int color, brushSize; Freehand(int color, int penWidth) { this.color = color; this.brushSize = penWidth; } DragGetter makeDragGetter(ProjectorApplet p) { /* Create a DragGetter which can accept incoming mouse drags and use them to draw lines */ return (int x1, int y1, int x2, int y2) -> { Line line = new Line(x1, y1, x2, y2, this.color, this.brushSize); p.commandQueue.add(line.makeProjectorCommand()); // Keep using this DragGetter, don't stop return false; }; } }