title: How to go back at previous scene
body: <p>I'm making 3 scenes in javafx scenebuilder.</p>
  
  <pre><code>Scene A: Edit Record -&gt; Scene C
  
  Scene B: View Record -&gt; Scene C
  
  Scene C: View Data
  </code></pre>
  
  <p>How can I go back to the previous scene(A or B) without creating a duplicate Scene C.</p>
  
  <pre><code>public void view(ActionEvent event) throws IOException{
      Parent mainpanelForm = FXMLLoader.load(getClass().getResource("Scene A or Scene B file location"));
      Scene mainpanelUI = new Scene(mainpanelForm);                 
      Stage mainpanel = (Stage) ((Node)event.getSource()).getScene().getWindow();  
      mainpanel.setScene(mainpanelUI);
      mainpanel.centerOnScreen();     
      mainpanel.setMaximized(true);
      mainpanel.show(); 
  }
  </code></pre>