title: Javafx: Change scene in setOnAction
body: <p>I'm building a JavaFX application with multiple Scenes. I have a problem with scope of variable when changing scenes within setOnAction event. This is my code:</p>
  
  <pre><code>Stage myStage;
  
  public Scene logInScene(){
     ... all the buttons / textFields
  
     createAccountButton.setOnAction(new EventHandler&lt;ActionEvent&gt;(){
          public void handle(ActionEvent t){
                **this.getStage().allScene(createAccountPane1);**
          }
     }
  }
  
  public Stage getStage(){
        return this.myStage;
  }
  
  public void allScene(Pane p){
        this.myStage.setScene(p);
  }
  </code></pre>
  
  <p>I'm getting an error within the setOnAction function. "Cannot Find Symbol" getStage(). I know this must be a scope problem and it doesn't recognize any variables / functions outside of that scope. How do I make it so that I can change within? I've tried passing through the variable but that will just make my code messy and I wish there was a simpler way. Thanks guys!</p>