title: Move image to point (not drag) in Java
body: <p>I have a little image in a <code>JPanel</code>. When i click on the panel, the image have to move to that point.
  This is the code of the mouse listener (in the constructor):</p>
  
  <pre><code>addMouseListener(new MouseAdapter(){
      public void mouseClicked(MouseEvent e) {
          if (moving) return;
          moveImageTo(e.getX(), e.getY());
      }
  });
  </code></pre>
  
  <p>The <code>moveImageTo</code>:</p>
  
  <pre><code>public void moveImageTo(int x, int y) {
      moving = true;
      moveThread.start();
  }
  </code></pre>
  
  <p>The thread is the problem, because I have the start position (a <a href="http://download.oracle.com/javase/6/docs/api/java/awt/Point.html" rel="nofollow">java.awt.Point</a>) and the end position (another <a href="http://download.oracle.com/javase/6/docs/api/java/awt/Point.html" rel="nofollow">java.awt.Point</a>), but i don't know how to calculate the direction and the step of moving. I also think that the thread have to call the <code>paint(Graphics g)</code> method at every step. Anyone have any hints or links?</p>