title: FXML-Controller runtime exception
body: <p>I am getting a runtime exception for this simple program i wrote. Exception occurs while "event" method is envoked(I think)</p>
  
  <p>example.java</p>
  
  <pre><code>public class Example extends Application {
  
      @Override
      public void start(Stage primaryStage) {
  
          try {
          Parent roo11 = FXMLLoader.load(getClass().getResource("example.fxml"));
  
           Scene scene = new Scene(roo11);
  
          primaryStage.setTitle("D-A-S-H Messenger");
          primaryStage.setScene(scene);
          primaryStage.show();
  
          } catch (IOException ex) {
              Logger.getLogger(Example.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>example.fxml</p>
  
  <p><a href="https://i.stack.imgur.com/vkPHM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vkPHM.jpg" alt="fxml code"></a></p>
  
  <p>ExampleController.java</p>
  
  <pre><code>public class ExampleController {
  
  
         @FXML JFXTextArea area;
  
         @FXML JFXTextField field;
  
         @FXML ImageView img;
  
       @FXML public void event(MouseEvent e){ 
  
        field.setOnMouseClicked((MouseEvent event) -&gt;
              {
              area.setText("Hello\n");
  
              });   
       }
   }       
  </code></pre>
  
  <p>Whenever I click the textfield exception occurs:</p>
  
  <p>Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException</p>