title: correct way to move a node by dragging in javafx 2?
body: <p>I'm converting a Swing/Graphics2D app with a lot of custom painting to a JavaFX2 app. Although I absolutely love the new API, I seem to have a performance problem when painting an ellipse that I want to paint below the mouse cursor wherever the mouse is moved. When I move my mouse in a steady way, not ridicously fast, I notice the ellipse is always drawn a few centimeters behind on the mouse trail, and only catches up when I stop moving the cursor. This in a scenegraph with only a handful nodes. In my Swing app I didn't have that problem.</p>
  
  <p>I'm wondering if this is the correct approach for drawing a shape where the mousecursor is?</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.event.EventHandler;
  import javafx.scene.Scene;
  import javafx.scene.SceneBuilder;
  import javafx.scene.input.MouseEvent;
  import javafx.scene.layout.Pane;
  import javafx.scene.paint.Color;
  import javafx.scene.shape.Ellipse;
  import javafx.scene.shape.EllipseBuilder;
  import javafx.stage.Stage;
  
  public class TestApp extends Application {
  public static void main(String[] args) {
      launch(args);
  }
  
  @Override
  public void start(Stage primaryStage) throws Exception {
      Pane p = new Pane();
  
      final Ellipse ellipse = EllipseBuilder.create().radiusX(10).radiusY(10).fill(Color.RED).build();
      p.getChildren().add(ellipse);
  
      p.setOnMouseMoved(new EventHandler&lt;MouseEvent&gt;() {
          public void handle(MouseEvent event) {
              ellipse.setCenterX(event.getX());
              ellipse.setCenterY(event.getY());
          }
      });
  
      Scene scene = SceneBuilder.create().root(p).width(1024d).height(768d).build();
      primaryStage.setScene(scene);
  
      primaryStage.show();
  }
  }
  </code></pre>
  
  <p><strong>Small update:</strong> I upgraded to JavaFX 2.2 and Java7u6 (on Windows 7 64bit), doesn't seem to make a difference though.</p>