是否可以在JavaFX.Button
的标签上添加TitledPane
?
找到解决方案! 资料来源:javawiki.sowas.com/doku.php?id=javafx:titledpane-with-checkbox
答案 0 :(得分:0)
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);