title: want to change label text from another fxml controller class in javafx
body: <p>I have two controller class Fxml1.java and Fxml2.java. In Fxml1.java I hava label Label l1, and in Fxml2.java I have text field t1. I have some text in text field t1 and I want to set this text to Label l1. i want to do some thing like below. Below is a just dummy code for understanding consider both class have separate fxml files. Here i receive NullPointerException.</p>
  
  <pre><code> //class Fxml1
      public class Fxml1{
  
      public label l1;
  
      l1.setText("hello");
  
      }
  
      //class Fxml2
      public class Fxml2{
      public TextField t1;
      public Button b1;
      public Fxml1 ob;
  
  
      public void onButtonSubmit(ActionEvent event){
      ob  = new Fxml1();
      ob.l1.setText(t1.getText());
      }
       public void initialize(URL url, ResourceBundle rb){
      t1.setText("This is textfield text");
      }
      }
  </code></pre>