BorderPane root = new BorderPane();
Button chooseFile = new Button("chooseFile");
TextField fileLocation = new TextField("C:/");
Button makeGrid = new Button("Solve");
HBox fileLoad = new HBox(chooseFile, fileLocation, makeGrid);
root.setTop(lastfil);
BorderPane.setAlignment(root, Pos.TOP_CENTER);
BorderPane.setMargin(root, new Insets(12,12,12,12));
root.setPrefSize(500, 500);
我遇到了一些问题,我希望 prefSize 为 500 x 500 并且文件加载器顶部居中,但它没有这样做。它在顶部,但我无法将它移到顶部的中心。有什么明显的我做错了吗?