How to bind line to a circle that is inside another node in JavaFX?
up vote
1
down vote
favorite
I have created a custom node (this is just a VBox derived node) that contains two sockets (circles) at right and left sides. The purpose is to connect them by dragging the sockets to another ones, and there should be drawn a line between them. Here I am just getting mouse x and y positions and drawing line between the sockets when drag detected on one of them. It is straightforward, but there is a problem when I move nodes. That is the lines are not bound to the sockets (circles). When I tried to bind them to the sockets (circles) centerX and centerY position, they were bound incorrectly because centerX and centerY positions are returned according VBox not a AnchorPane. I added my custom nodes to AnchorPane and the lines are drawn on it as well. So this is the problem circles are inside VBox