JavaFX将新布局添加到父布局中

JavaFX将新布局添加到父布局中,java,javafx,Java,Javafx,我有以下设置父布局的代码: public void start(Stage primaryStage) { try { Parent root = FXMLLoader.load(getClass().getResource("/view/BaseStructure.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResourc

我有以下设置父布局的代码:

public void start(Stage primaryStage) {
    try {
        Parent root = FXMLLoader.load(getClass().getResource("/view/BaseStructure.fxml"));
        Scene scene = new Scene(root);
        scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch(Exception e) {
        e.printStackTrace();
    }
}
我想在父布局的
右侧添加另一个布局。我怎样才能在主课上做到这一点

这是我的父布局
.fxml
文件的外观:

<VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.Main">
   //more code here
   <right>
     //need my second layout here
   </right>
</VBox>

//这里有更多代码
//需要我的第二个布局吗

您可以使用您选择的另一种布局,它包含两种布局:

HBox hbox = new HBox(10);
hbox.getChildren().addAll(getMySecondLayout(), root);
Scene scene = new Scene(hbox);
或者,您可以重新设计所有GUI并使用其他布局,如
BorderPane
AnchorPane