title: Dynamic Line between two points, click, move mouse, then click
body: <p>I have to draw a Line in Java. I click one point, then release the mouse key, move the mouse (the end of the line should be where the mouse cursor is (a dynamic preview)) then click the mouse key again to make the line. </p>
  
  <p>I see various questions on here, but most deal with holding a mouse button and dragging the mouse. </p>
  
  <p>My question is, how can I draw a line dynamically using the method above. I am concerned about repainting. I had code earlier and it drew all the lines as I moved the mouse. Is there a way to just have a preview. </p>