title: JavaFX TableView data not visible with CellValueFactory
body: <p>I'm working on a finance control type application for my parents in Java using JavaFX, but I'm having a problem with the GUI. I've searched Google and the code for a problem, but I can't seem to find anything wrong.</p>
  
  <p>This is the link I'm using as a guideline: <a href="http://docs.oracle.com/javafx/2/ui_controls/table-view.htm" rel="nofollow noreferrer">http://docs.oracle.com/javafx/2/ui_controls/table-view.htm</a></p>
  
  <p>I'm starting off with a Calender using TableView. By the way, is there any other way I can make a calender with JavaFX?</p>
  
  <p>Anyways, here is the code:</p>
  
  <p>package Finance;</p>
  
  <pre><code>import javafx.application.Application;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.geometry.Insets;
  import javafx.geometry.Pos;
  import javafx.scene.Group;
  import javafx.scene.Scene;
  import javafx.scene.control.Label;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.TableView;
  import javafx.scene.control.cell.PropertyValueFactory;
  import javafx.scene.layout.VBox;
  import javafx.scene.text.Font;
  import javafx.stage.Stage;
  
  import java.text.DateFormatSymbols;
  import java.util.Calendar;
  import java.util.GregorianCalendar;
  
  public class Main extends Application {
      Calendar calendar = new GregorianCalendar();
      private TableView&lt;Week&gt; table = new TableView&lt;Week&gt;();
  
      final ObservableList&lt;Week&gt; data = FXCollections.observableArrayList(
              new Week("1", "2", "3", "4", "5", "6", "7")
      );
  
      @Override
      public void start(Stage primaryStage) throws Exception {
          Scene scene = new Scene(new Group());
          primaryStage.setTitle("Finance Control");
          primaryStage.setWidth(1000);
          primaryStage.setHeight(700);
  
          Label month = new Label(getMonthForInt(calendar.get(Calendar.MONTH)));
          month.setFont(new Font("Arial", 30));
  
          table.setEditable(false);
          table.setPrefHeight(500);
          table.setPrefWidth(882);
  
          TableColumn sun = new TableColumn("Sunday");
          TableColumn mon = new TableColumn("Monday");
          TableColumn tue = new TableColumn("Tuesday");
          TableColumn wed = new TableColumn("Wednesday");
          TableColumn thu = new TableColumn("Thursday");
          TableColumn fri = new TableColumn("Friday");
          TableColumn sat = new TableColumn("Saturday");
  
          sun.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("a")
          );
  
          mon.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("b")
          );
  
          tue.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("c")
          );
  
          wed.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("d")
          );
  
          thu.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("e")
          );
  
          fri.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("f")
          );
  
          sat.setCellValueFactory(
                  new PropertyValueFactory&lt;Week, String&gt;("g")
          );
  
          TableColumn[] days = {sun, mon, tue, wed, thu, fri, sat};
          for (TableColumn day: days) {
              day.setPrefWidth(table.getPrefWidth()/7);
          }
  
          table.setItems(data);
          table.getColumns().addAll(sun, mon, tue, wed, thu, fri, sat);
  
          final VBox vbox = new VBox();
          vbox.setSpacing(5);
          vbox.setPadding(new Insets(10, 0, 0, 10));
          vbox.setAlignment(Pos.CENTER);
          vbox.getChildren().addAll(month, table);
          ((Group) scene.getRoot()).getChildren().addAll(vbox);
  
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  
      String getMonthForInt(int num) {
          String month = "wrong";
          DateFormatSymbols dfs = new DateFormatSymbols();
          String[] months = dfs.getMonths();
          if (num &gt;= 0 &amp;&amp; num &lt;= 11 ) {
              month = months[num];
          }
          return month;
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  
      public static class Week {
          String a;
          String b;
          String c;
          String d;
          String e;
          String f;
          String g;
  
          public Week(String a, String b, String c, String d, String e, String f, String g) {
              this.a = a;
              this.b = b;
              this.c = c;
              this.d = d;
              this.e = e;
              this.f = f;
              this.g = g;
          }
      }
  }
  </code></pre>
  
  <p>This is what happens when I run it. I would expect it to populate with the values I gave the Constructor of the Week object, but it isn't - it just shows empty cells.</p>
  
  <p><img src="https://i.stack.imgur.com/rn75P.png" alt="http://i.imgur.com/ZrhPIDe.png"></p>
  
  <p>I'm using IDEA IDE if that matters... I'd be grateful for any help with this or any comments. I'll probably be using scenebuilder at some point, but I wanted to get a feel for the actual code first before going to the GUI builder.</p>