Making a block connector in JavaFX

I want to create a blocks that will be connected with a line. It have to be look like in this image.

Or also if this will be hard to do it also can be like that (With straight lines).

I tried to do it but I had some problems. I think I need to do it using onDragDetected and onMouseDragEntered inside FXML for controller check and do some code but I don't know how exactly to do. Also my other problem is that I want to do this blocks movable with mouse drag but if my circle will be inside the block (how I do it) that will make this circle movable with the block but I have to move only line from this circle.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum