title: My simple table view doesn't work in javaFX
body: <p>I am a beginner to javaFx and I am now inserting data from my Person Objects to my tableView with the help of online toturials.But my code has some problems.There is neither compile time nor run time errors.But there is no data in my tableView.Being a beginner at javaFx,I have checked my code for a long time.But I don't know why it is.Could you take a look at that please?Here is my modal class,Person.java</p>
  
  <pre><code>public class Person {
          public  SimpleStringProperty firstName;
          public SimpleStringProperty lastName;
  
          public Person(String fName, String lName) {
              this.firstName = new SimpleStringProperty(fName);
              this.lastName = new SimpleStringProperty(lName);
          }
  }
  </code></pre>
  
  <p>This is my controller class</p>
  
  <pre><code>public class FXMLDocumentController implements Initializable {
  
      private ObservableList&lt;Person&gt; personData = FXCollections.observableArrayList();
  
     @FXML
     private TableView&lt;Person&gt; table;
       @FXML
      private TableColumn&lt;Person, String&gt; col1;
      @FXML
      private TableColumn&lt;Person, String&gt; col2;
  
      @Override
      public void initialize(URL url, ResourceBundle rb) {
           col1.setCellValueFactory(
              new PropertyValueFactory&lt;Person,String&gt;("firstName")
          );
  
          col2.setCellValueFactory(
              new PropertyValueFactory&lt;Person,String&gt;("lastName")
              );  
          personData.add(new Person("John","Leon"));
          System.out.println("data to collection added");
          table.setItems(personData);
          System.out.println("collection  to table added");
  
  
      }    
  
  }
  </code></pre>
  
  <p>And this is my FXML code</p>
  
  <pre><code>&lt;AnchorPane id="AnchorPane" prefHeight="332.0" prefWidth="409.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="fucktable.FXMLDocumentController"&gt;
      &lt;children&gt;
        &lt;TableView fx:id="table" layoutX="42.0" layoutY="54.0" prefHeight="200.0" prefWidth="200.0"&gt;
          &lt;columns&gt;
            &lt;TableColumn fx:id="col1" prefWidth="75.0" text="C1" /&gt;
            &lt;TableColumn fx:id="col2" prefWidth="75.0" text="C2" /&gt;
          &lt;/columns&gt;
        &lt;/TableView&gt;
      &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>Thanks for your attention</p>