title: How to properly switch scenes/change root node of scene in JavaFX without FXML?
body: <p>I'm learning javafx and I already got basics done so now I want to make a bit more complex project. I read many guides online on this topic but I can't find anywhere how to switch scenes or change root node when every class represent 1 scene.<br>
  To understand better here is simplified version of my project:<br>
  Let's say that I have 3 classes A, B and C:</p>
  
  <pre><code>public class A{
      private Stage stage;
      A(Stage stage){
           this.stage = stage;
      }
      public void showGui(){
          // This will make all elements, put them on scene and then set that scene to stage
      }
      public void callB(){
          B b = new B(Stage);
          b.showGui();
      }
  } 
  public class B{
      private Stage stage;
      B(Stage stage){
           this.stage = stage;
      }
      public void showGui(){
          // This will make all elements, put them on scene and then set that scene to stage
      }
      public void callC(){
          C c = new C(Stage);
          c.showGui();
      }
  } 
  public class C{
    // This is completely same as other two, it calls A so those 3 form some sort of circle.  
  }
  </code></pre>
  
  <p>At start of program inside  <strong>public void start(Stage primaryStage)</strong> I make object of A and pass it primary stage then in each class I change it, and it works fine. But I have few questions about it:<br>
  Is this a proper way of doing it?<br>
  Is there any other way to do it while keeping classes or I should just do all inside main class?<br>
  Is it better to pass Scene and then change root nodes?  </p>
  
  <p>Sorry if I ask a bit too much, but I read a lot about it still couldn't find anything that can help me, so this is my last solution.</p>