Adding a custom component to SceneBuilder 2.0
I have the need to have a selection listener and select method on a pane to be able to monitor and present a highlight when a node is clicked on. I did the following: public class PaneWithSelectionListener extends Pane { private ObjectProperty<Annotation> selectedAnnotation = new SimpleObjectProperty<>(); public PaneWithSelectionListener() { super(); selectedAnnotation.addListener((obs, oldAnno, newAnno) -> { if (oldAnno != null) { oldAnno.setStyle(""); } if (newAnno != null) { newAnno.setStyle("-fx-border-color: blue;-fx-border-insets: 5;-fx-border-width: 1;-fx-border-style: dashed;"); } });