title: Register the MouseListener and MouseMotionListener so a JPanel properly handles mouse events
body: <p>Im trying to teach myself some basic java by working through this Exercise 14.17 here</p>
  
  <p><a href="http://my.safaribooksonline.com/book/programming/java/9780132770873/gui-components-part-1/ch14lev1sec25" rel="nofollow">Basic Java Exercise</a></p>
  
  <p>Im stuck on one simple thing which is where it says </p>
  
  <p><strong>register the MouseListener and MouseMotionListener so the JPanel properly handles mouse events.</strong></p>
  
  <p>Ive already written 3 methods</p>
  
  <pre><code>public void mousePressed(MouseEvent e)
  public void mouseReleased(MouseEvent e)
  public void mouseMoved(MouseEvent e)
  </code></pre>
  
  <p>How exactly do i register the MouseListener and MouseMotionListener?</p>
  
  <p>Thnaks              </p>