public void start(Stage primaryStage)
{
btn1 = new Button();
btn2 = new Button("h1");
btn3 = new Button("h2");
btn.setText("Click me please!");
BorderPane pane = new BorderPane();
HBox pane2 = new HBox();
pane2.getChildren().add(btn1);
pane2.getChildren().add(btn2);
pane2.getChildren().add(btn3);
pane.setCenter(pane2);
Scene scene = new Scene(pane, 700, 550);
primaryStage.setScene(scene);
primaryStage.setTitle("The Click Me App");
primaryStage.show();
}
我希望我的按钮位于BorderPane的中心....我做错了什么?请帮忙。现在他们处于最佳位置。
答案 0 :(得分:0)
尝试:
pane.setCenter(pane2);
pane2.setAlignment(Pos.CENTER);