JavaFX Same textarea with different Pane's
<p>I have a project with maven, javafx and fxml. I have one main BorderPane, <code>welcome.fxml</code>, and Pane, <code>ready.fxml</code>.</p>

<p>My start method is;</p>

<pre><code>@Override
public void start(Stage primaryStage) throws Exception {

    try {
      Pane root = (Pane) FXMLLoader.load(getClass().getResource("welcome.fxml"));
      Scene scene = new Scene(root, 640, 480);
      primaryStage.setScene(scene);
      primaryStage.show();
    } catch (Exception e) {
      makeAlert(e, false);
    }
}
</code></pre>

<p>Now, I have a button in my <code>welcome.fxml</code>, and I want to change my BorderPane's center with <code>ready.fxml</code>. Here is my button handler;</p>

<pre><code>@FXML
private void buttonHandler() throws IOException, InterruptedException {


    stage = (Stage) myButton.getScene().getWindow();
    Pane sub = (Pane) FXMLLoader.load(getClass().getResource("../ready.fxml"));
    BorderPane root = (BorderPane) FXMLLoader.load(getClass().getResource("../welcome.fxml"));
    root.setCenter(sub);

    //Scene scene = new Scene(root, 640, 480);
    //stage.getScene().setRoot(root);
}
</code></pre>

<p><strong>UPDATE</strong>: Here is my mistake,as @James_D noticed, I load <code>welcome.fxml</code> again in my controller and so, my whole Scene changes insted of only center. </p>

<p>The correct way should be;</p>

<pre><code>stage = (Stage) brokerConnect.getScene().getWindow();
Pane center = (Pane) FXMLLoader.load(getClass().getResource("../ready.fxml"));
// FIXME: Get root like this
BorderPane root = (BorderPane) stage.getScene().getRoot();
root.setCenter(center);
</code></pre>

<p>EDITED: Java codes added.</p>