Is it possible to add a JavaFX.Button on a Label of TitledPane?

Solution found! Source: javawiki.sowas.com/doku.php?id=javafx:titledpane-with-checkbox
TitledPane titledPane = new TitledPane(); // or TitledPane(null,content)
BorderPane borderPane = new BorderPane();
Label titleOfTitledPane = new Label("SomeText");
Button buttonClose = new Button("X");
borderPane.setCenter(titleOfTitledPane);
borderPane.setLeft(buttonClose);
borderPane.prefWidthProperty().bind(scene.widthProperty().subtract(40));
titledPane.setGraphic(borderPane);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With