I got some Circle objects which I want to join with a Line when dragging from the circles.
I started with this code in order to test being and end drag and drop coordinates:
Circle nodo = new Circle(15.0);
nodo.setOnDragDetected(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
coordenadas[0] = event.getX();
coordenadas[1] = event.getY();
}
});
nodo.setOnDragDropped(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent event) {
coordenadas[2] = event.getX();
coordenadas[3] = event.getY();
System.out.println(coordenadas);
}
});
When I try to drag a Circle nothing is being printed out to console when I drop the mouse. What's the correct approach and how should I being drawing a Line on dragging.