I am having a problem centering a button in my borderpane to be centered according to the stage. It is centered according to the borderpane but I want it to be in the exact center of the window.
I am referring to the bottom part of my picture which has the play button and difficulty choiceBox.
I am using a borderpane to have the difficulty part be on the right side and the play button in the center.
As you can see, play is not centered in the picture.
I would like to do that but I'm not sure how. I think that I could possibly set the width of my left node to be equal to my right node but I don't have anything for my left Node.
// 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);