我正在尝试创建游戏的第一个窗口,并创建一个菜单以放置在第一个屏幕的中心。
BorderPane bp = new BorderPane();
Button Start = new Button("Start");
Button Mute = new Button("Mute");
Button Exit = new Button("Quit");
Button Options = new Button("Options");
/*
* Vbox in Center for buttons:
* (non-Javadoc)
* @see javafx.application.Application#start(javafx.stage.Stage)
*/
public void start(Stage primaryStage) {
VBox vb = new VBox(100);
vb.getChildren().addAll(Start,Options,Mute,Exit);
vb.setMargin(Start, new Insets(0,0,0,15));
vb.setMargin(Options, new Insets(0,0,0,15));
vb.setMargin(Mute, new Insets(0,0,0,15));
vb.setMargin(Exit, new Insets(0,0,0,15));
bp.setCenter(vb);
Scene scene = new Scene(bp, WIDTH, HEIGHT);
primaryStage.setTitle("Tetris");
primaryStage.setScene(scene);
primaryStage.show();
}