title: Am I approaching this correctly?
body: <p>JavaFX 8 – FXML – TableView – TableColumn
  I have the following objects</p>
  
  <pre><code>CourseResult
      SimpleStringProperty CourseID
      SimpleStringProperty CourseName
      SimpleStringProperty Grade
      SimpleIntegerProperty Credits
  
  ATableRow
      SimpleStringProperty StudentID
      SimpleStringProperty StudentName
      CourseResult[]  AResult  // Occurs 1 to 20.
  </code></pre>
  
  <p>In my program</p>
  
  <pre><code>javafx.collections.ObservableList&lt;ATableRow&gt; TableData = javafx.collections.FXCollections.observableArrayList();
  </code></pre>
  
  <p>I populate this Observable list from the database and I am able to see all the values perfectly in debugger.
  I create the Tableview and add columns.</p>
  
  <pre><code>    public void createTableForThisSemester(int thisSemester, int numberOfCourses, javafx.collections.ObservableList&lt;AResultRow&gt; TableRows) {
  
          TableView&lt;AResultRow&gt; thisTable = new TableView&lt;&gt;();
  
          TableColumn&lt;AResultRow, String&gt; tcolRollNo = new TableColumn&lt;&gt;("Roll Number");
          tcolRollNo.setEditable(false);
          tcolRollNo.setPrefWidth(120);
  
          TableColumn&lt;AResultRow, String&gt; tcolName = new TableColumn&lt;&gt;("Student Name");
          tcolName.setEditable(false);
          tcolName.setPrefWidth(350);
  
          tcolRollNo.setCellValueFactory(cellData -&gt; cellData.getValue().StudentIDProperty());
          tcolName.setCellValueFactory(cellData -&gt; cellData.getValue().StudentNameProperty());
          boolean xyz = thisTable.getColumns().addAll(tcolRollNo, tcolName);
  
   //       TableColumn[] courseColumn = new TableColumn[numberOfCourses];
  
          for (int courseNo = 0; courseNo &lt; numberOfCourses; courseNo++) {
              String colName = getASemesterCourse(thisSemester, courseNo).getCourseID();
              TableColumn&lt;AResultRow, String&gt; thisColumn = new TableColumn&lt;&gt;(colName);
              thisColumn.setPrefWidth(80);
              thisColumn.setStyle("-fx-alignment: CENTER; font-weight:bold;");
  
  thisColumn.setCellValueFactory(cellData -&gt; cellData.getValue().courseGradeProperty(courseNo));
  
              boolean retVal = thisTable.getColumns().addAll(thisColumn);
          }
  //        System.out.println("# of Rows in Table [" + thisSemester + "] = " + TableRows.size());
  
          thisTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
          thisTable.setItems(TableRows);
  
          ScrollPane thisScrollPane = new ScrollPane();
          thisScrollPane.setFitToWidth(true);
          thisScrollPane.setFitToHeight(true);
          thisScrollPane.setMinHeight((theDetails.getHeight() - 25));
          thisScrollPane.setMaxHeight((theDetails.getHeight() - 25));
          thisScrollPane.setMinWidth((theDetails.getWidth() - 25));
          thisScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
          Tab thisTab = tabs.getTabs().get(thisSemester);
          thisTab.setContent(thisScrollPane);
  
          thisScrollPane.setContent(thisTable);
      }
  </code></pre>
  
  <p>Columns StudentID and Name are perfectly populated. But the Results are not being populated in </p>
  
  <p>thisColumn.setCellValueFactory(cellData -> cellData.getValue().courseGradeProperty(courseNo));</p>
  
  <p>I get this error in Netbeans for the line shown above. "Local Variables referenced from a lambda expression must be final or effectively final".</p>
  
  <p>Remember, the GRADE[courseNo] field is a String and is populated.</p>
  
  <p>How to show this value in the TABLE.</p>
  
  <p>I have been trying various methods, like storing this value in a temp String... etc. etc.</p>