title: Mouse Dragging Logic
body: <p>Here is some code which makes a <code>GCompound</code> move correctly with dragging.</p>
  
  <pre><code>public void mouseDragged(MouseEvent e) {
      currentLabel.setLocation(e.getX()+DX, e.getY()+DY);
  }
  public void mousePressed(MouseEvent e) { 
      currentLabel = (coolLabel) getElementAt(e.getX(),e.getY());
      DX = currentLabel.getX()-e.getX();
      DY = currentLabel.getY()-e.getY();
      currentLabel.sendToFront();
  }
  </code></pre>
  
  <p>Here it is without it moving correctly:</p>
  
  <pre><code>public void mouseDragged(MouseEvent e)
  {
      currentLabel.move(e.getX()+DX, e.getY()+DY);
  }
  
  public void mousePressed(MouseEvent e) { 
      currentLabel = (coolLabel) getElementAt(e.getX(),e.getY());
      DX = -e.getX();
      DY = -e.getY();
      currentLabel.sendToFront();
  }
  </code></pre>
  
  <p>Can someone explain why this is so? Seems both versions of my code are using the same thinking... Basically in the first case I take the original <code>GObject</code> and <strong>set</strong> its location based on the difference from my original position, and in the second case I <strong>move</strong> the original object based on the difference from my original position.</p>