title: java draw line as the mouse is moved
body: <p>I would like to add a feature to my application which allows the user to draw a straight line by clicking the mouse at the start location and releasing it at the end location.  The line should move as the mouse moves until it is finally released; similar to the way that a line can be drawn using the Microsoft Paint application.</p>
  
  <p>How can implement this so that the line is repainted as it moves without repainting other things that may already be drawn in that rectangular area?</p>