title: Change Scene without resize window in JavaFX
body: <p>I'm trying to change Scenes on JavaFX, but without change the window size. However, when I set <code>stage.setScene(scene2);</code> the window size decreases, and I want to keep the both Scenes maximized. I've tried to <code>stage.setMaximized(true)</code> after the <code>stage.setScene(scene2);</code> but the result is the same.</p>
  
  <p>How can I fix it?</p>
  
  <p>My code:</p>
  
  <pre><code>package controller;
  
  import java.io.IOException;
  
  import javafx.animation.FadeTransition;
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  import javafx.util.Duration;
  
  public class App extends Application {  
      @Override
      public void start(Stage stage) throws Exception {
          Parent root = FXMLLoader.load(getClass().getResource("../view/fxml/Loading.fxml"));
  
          Scene scene = new Scene(root);
  
          stage.setScene(scene);
          stage.setTitle("Project");
          stage.setMaximized(true);
          stage.show();
  
          FadeTransition fadeIn = new FadeTransition(Duration.seconds(1), root);
          fadeIn.setFromValue(0);
          fadeIn.setToValue(1);
  
          FadeTransition fadeOut = new FadeTransition(Duration.seconds(1), root);
          fadeOut.setFromValue(1);
          fadeOut.setToValue(0);
  
          fadeIn.play();
  
          fadeIn.setOnFinished((e) -&gt; {
              fadeOut.play();
          });
  
          fadeOut.setOnFinished((e) -&gt; {
              try {               
                  Parent root2 = FXMLLoader.load(getClass().getResource("../view/fxml/Welcome.fxml"));
  
                  Scene scene2 = new Scene(root2);
  
                  stage.setScene(scene2);
              } catch (IOException e1) {
                  e1.printStackTrace();
              }
          });
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>When I compile:
  <a href="https://i.stack.imgur.com/h3KmV.png" rel="nofollow"><img src="https://i.stack.imgur.com/h3KmV.png" alt="enter image description here"></a></p>
  
  <p>Then the fadeOut/fadeIn occurs and (It is here that I want to keep maximized):
  <a href="https://i.stack.imgur.com/qi2Ow.png" rel="nofollow"><img src="https://i.stack.imgur.com/qi2Ow.png" alt="enter image description here"></a></p>