title: Initialize method not invoking
body: <p>I want to add a spinner in my javafx project including maxmimum(1) and minimum(5).</p>
  
  <p>The problem is that the initialize method is not invoking.
  When does the initialize should be invoked? Why doesn't it?</p>
  
  <p>This is the App.java code:</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  public class AverageApp extends Application {
  
      @Override
      public void start(Stage stage) throws Exception {
          Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
  
          Scene scene = new Scene(root);
  
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>This is my FXMLController.java Code</p>
  
  <pre><code>import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Spinner;
  import javafx.scene.control.SpinnerValueFactory;
  
  import javafx.scene.input.*;
  
  public class FXMLDocumentController implements Initializable{
  
      @FXML private Spinner spi;
  
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          System.out.println("HI");
          this.spi.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 5));
      }
  
  }
  </code></pre>
  
  <p>And This is my FXMLDocument.fxml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.web.*?&gt;
  &lt;?import javafx.scene.image.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  
  &lt;AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="714.0" prefWidth="584.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1"&gt;
     &lt;children&gt;
        &lt;AnchorPane layoutX="108.0" layoutY="30.0"&gt;
           &lt;children&gt;
              &lt;Spinner fx:id="spi" /&gt;
           &lt;/children&gt;
        &lt;/AnchorPane&gt;
        &lt;Label layoutX="278.0" layoutY="34.0" text="تعداد واحد :" /&gt;
        &lt;Label layoutX="510.0" layoutY="34.0" text="نام درس :" /&gt;
        &lt;TextField alignment="CENTER" layoutX="380.0" layoutY="30.0" nodeOrientation="LEFT_TO_RIGHT" prefHeight="25.0" prefWidth="120.0" /&gt;
        &lt;Button layoutX="34.0" layoutY="98.0" mnemonicParsing="false" text="اضافه کردن" /&gt;
        &lt;Label layoutX="520.0" layoutY="123.0" text="Label" /&gt;
        &lt;Label layoutX="520.0" layoutY="162.0" text="Label" /&gt;
     &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>