将 VBox 的值设置为不同的 FXML VBox?

Setting the value of VBox to a different FXML VBox?

您可以使用 BorderPane 来做到这一点,即:

    FXMLLoader loader = new FXMLLoader(getClass().getResource("contacts.fxml"));
    HBox root = loader.load();
    rootPane.setTop(root);
}

VBox 没有 .set(node) 方法。

对于 VBox(以及许多其他 Pane),您只需修改 children ObservableList,就像修改任何其他 List 一样.

例如

// add root as bottom-most child of rootPane
rootPane.getChildren().add(root);