ボーダーペインのボタンをステージに合わせて中央に配置するのに問題があります。ボーダーペインに従って中央に配置されていますが、ウィンドウの正確な中央に配置したいです。
再生ボタンと難易度選択ボックスがある私の写真の下部を参照しています。
ボーダーペインを使用して、難しい部分を右側に、再生ボタンを中央に配置しています。
ご覧のとおり、遊びは絵の中心ではありません。
私はそれをしたいのですが、方法がわかりません。左ノードの幅を右ノードと等しくなるように設定できると思いますが、左ノードには何もありません。
// bottom section for positioning
BorderPane settings = new BorderPane();
settings.setPadding(new Insets(10));
// play button
Button playBtn = new Button("Play");
settings.setCenter(playBtn);
// difficulty options
Label diffLabel = new Label("Difficulty: ");
ChoiceBox<String> diffBox = new ChoiceBox<String>(FXCollections.observableArrayList(
"Easy", "Standard", "Hard"
));
diffBox.getSelectionModel().select(1);
// for wrapping the diffuclty.
HBox difficulty = new HBox(diffLabel, diffBox);
difficulty.setAlignment(Pos.CENTER);
difficulty.setSpacing(10);
settings.setRight(difficulty);