title: Changing scenes with Alert JavaFX
body: <p>I'm using JavaFX and trying to make a small GUI application where the user can interact with spacetraders.io API.
  I've implemented an Alert dialog box when the user attempts to make any transaction (purchase a ship, obtain a loan, purchase goods, sell goods...), and once the user has confirmed their transaction, the stage will be switched to a stage that displays the results of the transaction when shown.</p>
  <p><a href="https://i.stack.imgur.com/tVN23.png" rel="nofollow noreferrer">Correct Display</a></p>
  <p>The Alert dialog box functions fine but the switching of stage presents an issue. When I switch the stage, the full scene is not loaded for some odd reason, the back button is chopped off.</p>
  <p><a href="https://i.stack.imgur.com/bdqsa.png" rel="nofollow noreferrer">Chopped Off Display</a></p>
  <p>When I then click anywhere on the window, the stage is fully shown as in the first image. (all it takes is one click anywhere inside the window).</p>
  <p>When I remove the Alert, the stage loads fine. But when I put the same code into an ifPresent lambda, the stage fails to load fully/properly.</p>
  <pre><code>Alert alert = new Alert(Alert.AlertType.CONFIRMATION, &quot;Are you sure you want to obtain this loan?&quot;);
  alert.showAndWait().ifPresent(response -&gt; {
      if (response == ButtonType.OK) {
          BorderPane borderPane = new BorderPane();
          //make title, backbtn, res
          borderPane.setTop(title);
          borderPane.setBottom(backBtn);
          borderPane.setCenter(res);
          Scene scene = new Scene(borderPane, 600, 400);
          primaryStage.setScene(scene);
          primaryStage.show();
          event.consume();
      }
  });
  </code></pre>
  <p>I've looked at the docs and I can't seem to figure out why this is the case? Any solutions are welcome?</p>