Possible to Drag Shapes Within a GridPane with JavaFX
<p>Am I correct in thinking it is not possible to drag Shapes within a GridPane? Here's a link to some code that allows the user to drag shapes around the screen: <a href="http://www.java2s.com/Tutorials/Java/JavaFX_How_to/Shape/Handle_Shape_drag_and_drop_events.htm" rel="nofollow">Drag and Drop Shapes</a></p>

<p>I want my shapes to have the same behavior as above, but I want them in a GridPane (eventually I'd like their movement to be locked to the X or Y axis to be moved on to adjacent shapes).</p>

<p>I added the below code to the "start" method. It creates circles using the same method as the example code but instead adds them to a grid. Surprisingly, this <em>removed</em> the ability for them to be dragged around.</p>

<pre><code>GridPane grid = new GridPane();
grid.setLayoutX(300);
grid.setLayoutY(100);

int n = 3;
int m = 3;
for (int r = 0; r &lt; n; r++) {
    for (int c = 0; c &lt; m; c++) {

        Circle circle = createCircle(100, 50, 30, Color.BLACK);
        grid.add(circle, c, r);
    }
}
root.getChildren().add(grid);
</code></pre>

<p>If you want to test this just add the above code to the "start" method of the example code, just above these lines:</p>

<pre><code>primaryStage.setScene(scene);
primaryStage.show();
</code></pre>

<p>My theory is the GridPane, because it locks the circles to certain positions, doesn't allow this dragging behavior.</p>

<p>Any input on how I can achieve movement of the circles along the X and Y axis when dragged?</p>