Step 2:

Implement functionality so that if the user is able to move a line to a new location. If the user generates a mousePressed event at point P which is near a line, then the line will move by whichever displacement occurs between P and the mouse location P' at the point of the mouseReleased event.
The definition of "near" to a line is left to you: it should be forgiving enough so the user does not need to pinpoint the line exactly, but not so generous so that the user's ability to selectively distinguish among lines in close proximity is hampered.

Aspect to consider: the example code has a sub-optimal implementation with respect to NEAR_THRESHOLD. Note that the proximity threshold is not uniformly applied around the perimeter of the passed point.

Aspect to consider: in the above specification, there is no provision to give the user any feedback as to whether their mouse tracker is actually near a line or not in advance of actually attempting a move operation.


Example - before mousePressed and mouseReleased events

Pasted Graphic

Example - after mousePressed and mouseReleased events

Pasted Graphic 2