title: Passing variable between controllers in javafx after initialization
body: <p>How can I pass variables between two controllers that are initializable? After logging in, the username is null in the second page because it already  initialized(I am using a framework). Can I run a method to load the variables after initialization? </p>
  
  <p>So here is a code snippet:
  logincontroller</p>
  
  <pre><code>public static String myusername;
  public static String myaccount; 
  
  @FXML
  private JFXTextField username;
  
  @FXML
  public void makeLogin(ActionEvent event) {      
  Document query = new Document();
  query.put("userName", username.getText());
  
  FindIterable&lt;Document&gt; docs = userCollection.find(query);
  
  if(docs != null){
      if(detailsmatch(username, password)){
  
          String theaccount = (String) doc.get("account");
  
          USERSingleton.getInstance().setusername(username.getText());                                
          USERSingleton.getInstance().setaccount(theaccount);
  
          myusername = USERSingleton.getInstance().getusername();
          myaccount = USERSingleton.getInstance().getaccount();
  
          myScreenPane.setHomeScreen("home");
  
      }
  }
  
  @Override
  public void initialize(URL url, ResourceBundle rb) {     
  
  }  
  
  @Override
  public void setScreenPane(screenPane screenPage) {
      myScreenPane = screenPage;
  }
  }
  </code></pre>
  
  <p>So I would like to get the account variable in the homecontroller from the logincontroller. Like:</p>
  
  <p>homecotroller</p>
  
  <pre><code>System.out.println(logincontroller.myaccount);
  System.out.println(USERSingleton.getInstance().getaccount());
  </code></pre>
  
  <p>.
  .</p>