调整 window 大小时 GridPane 保持居中

GridPane stay centered while window is resized

目前我的网格窗格在 window 调整大小时保持在 X 轴的中心,我怎样才能让它也保持在 Y 轴的中心?

我在 TabPane 的选项卡中有这个:

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(20, 0, 0, 0));
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(20);
    grid.setVgap(20);

    this.setContent(grid);

这里的关键是VBox.setVgrow(tabPane, Priority.ALWAYS);

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.MenuBar;
import javafx.scene.control.TabPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

/**
 *
 * @author blj0011
 */
public class JavaFXApplication65 extends Application
{

    @Override
    public void start(Stage primaryStage)
    {
        VBox root = new VBox();
        MenuBar mb = new MenuBar();

        TabPane tabPane = new TabPane();
        root.getChildren().addAll(mb, tabPane);


        //StackPane stackPane = new StackPane();
        CreateProfilePane cp = new CreateProfilePane();
        tabPane.getTabs().add(cp);
        VBox.setVgrow(tabPane, Priority.ALWAYS);



        Scene scene = new Scene(root, 300, 250);

        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        launch(args);
    }

}