Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX.TitledPane with Button

Is it possible to add a JavaFX.Button on a Label of TitledPane? enter image description here

Solution found! Source: javawiki.sowas.com/doku.php?id=javafx:titledpane-with-checkbox

like image 658
SkaaRJ Avatar asked Oct 21 '25 17:10

SkaaRJ


1 Answers

    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);
like image 127
SkaaRJ Avatar answered Oct 23 '25 05:10

SkaaRJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!