title: Java FX disable variable in Controller constructor causes nullpointer
body: <p>So I am new to Java FX and I have a textfield element which I want to disable editing on. I can't change it to just text as I need a field later on. Besides, I really want to find out why this is happening. </p>
  
  <p>This is how my constructor and variable declaration looks like:</p>
  
  <pre><code>   @FXML
      private TextField display;
  
  public Controller(){
      display.setEditable(false);
      display.setMouseTransparent(true);
      display.setFocusTraversable(false);
  
  }
  </code></pre>
  
  <p>This is my FXML:</p>
  
  <pre><code>      &lt;TextField fx:id="display" id="displayCSS"&gt;&lt;/TextField&gt;
  </code></pre>
  
  <p>Everytime I launch the application, I get a nullpointer exception beacuse I can't use any methods on a null object. Fine. So I moved the constructor code to a clicklistener for another button and that worked just fine. So I can use the display reference any time I want, except in the constructor. Is there something about constructors and Java fx that I don't understand? Why is this happening? </p>