Step 1:

For all of the steps described herewithin, the MVC architecture should be employed. The code from the textBookEgs_Chapter3 project is a appropriate starting point..

Add functionality to the code so that the user can add lines to the drawing surface. The action should be implemented so that a mousePressed event at a given point P corresponds to the specification of P as one of the new line's endpoints. The mouseReleased event at another point P' corresponds to the specification of the new line's other endpoint.

NB: the modelHasChanged() method needs to invoke repaint() after the invalidate() method.


Examples

Pasted Graphic