带有按钮的 JavaFX.TitledPane

标签 java javafx javafx-8

是否可以在 TitledPane 的标签上添加 JavaFX.Buttonenter image description here

已找到解决方案! 来源: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);

关于带有按钮的 JavaFX.TitledPane,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49085827/

相关文章:

JavaFX - MediaPlayer 不工作

javafx - 在 JavaFx 中在 TableView 中的特定行位置显示工具提示

java - 调试动态代理创建会改变调用处理程序状态

java - Selenium - 创建 UI 驱动的自动化框架

java类不通过cmd编译代码

缩小窗口时 JavaFX backgroundImage 消失

javafx - 在 WebEngine JavaFX 中设置 HTTP header

java - 使用 JavaFX 的窗口内的棋盘

styles - 如何在 JavaFX 8 中保留 JavaFX 7 皮肤?

java - 如何仅通过错误在 Eclipse 中循环?