title: Javafx tableview not showing data in all columns
body: <p>OK, new to java by several weeks, but have been programming for 30 years.  The following code executes, but only the first column is showing anything.  The data object is showing multiple rows of data, with fields of data that are filled in.  I'm sure I'm missing something, and have looked through similar questions on here.</p>
  
  <p>APVoucher_batchgridController.java</p>
  
  <pre><code>import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.Initializable;
  import javafx.fxml.FXML;
  import javafx.scene.control.TableView;
  import javafx.scene.input.MouseEvent;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  import java.sql.Statement;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.cell.PropertyValueFactory;
  
  /**
   * FXML Controller class
   *
   * @author kmitchell
   */
  public class APVoucher_batchgridController implements Initializable {
  
      public TableView tblMainList;
      public TableColumn colDateEntered;
      public TableColumn colCreatedBy;
      public TableColumn colDescription;
  
      /**
       * Initializes the controller class.
       */
      @Override
      public void initialize(URL url, ResourceBundle rb) {
  
      }
  
      @FXML
      public void opentables(ActionEvent event) {
  
          Object forName = null;
          Connection conn = null;
          Statement stmt = null;
  
          ResultSet rs = null;
  
          colDateEntered.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("DateEntered"));
  
          colDescription.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("cDesc"));
  
          colCreatedBy.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("CreatedBy"));
  
          try {
              // load the driver into memory
              forName = Class.forName("jstels.jdbc.dbf.DBFDriver2");
  
          } catch (ClassNotFoundException ex) {
              Logger.getLogger(APVoucher_batchgridController.class.getName()).log(Level.SEVERE, null, ex);
          }
  
          try {
              conn = DriverManager.getConnection("jdbc:jstels:dbf:e:\\keystone-data\\keyfund\\seymour\\keyfund.dbc");
          } catch (SQLException ex) {
              Logger.getLogger(APVoucher_batchgridController.class.getName()).log(Level.SEVERE, null, ex);
          }
  
          if (conn != null) {
              try {
                  stmt = conn.createStatement();
              } catch (SQLException ex) {
                  Logger.getLogger(APVoucher_batchgridController.class.getName()).log(Level.SEVERE, null, ex);
              }
  
              if (stmt != null) {
  
                  // execute a query
                  try {
                      ObservableList&lt;Object&gt; data = FXCollections.observableArrayList();
  
                      rs = stmt.executeQuery("SELECT denteredon, cdesc, ccreatedby FROM apvbatch WHERE ldeleted = false ORDER BY denteredon DESC");
  
                      while (rs.next()) {
  
                          String enteredon = rs.getString("denteredon");
                          String desc = rs.getString("cdesc");
                          String createdby = rs.getString("ccreatedby");
  
                          sresult row = new sresult(createdby, enteredon, desc);
  
                          data.add(row);
                      }
  
                      tblMainList.setItems(data);
  
                      tblMainList.setVisible(true);
  
  
                  } catch (SQLException ex) {
                      Logger.getLogger(APVoucher_batchgridController.class.getName()).log(Level.SEVERE, null, ex);
                  }
              }
          }
      }
  
      public class sresult {
  
          private String DateEntered;
          private String EnteredBy;
          private String cDesc;
  
          public sresult(String T, String d, String c) {
              this.EnteredBy = T;
              this.DateEntered = d;
              this.cDesc = c;
          }
  
          public String getEnteredBy() {
              return EnteredBy;
          }
  
          public void setEnteredBy(String T) {
              EnteredBy = T;
          }
  
          public String getDateEntered() {
              return DateEntered;
          }
  
          public void setDateEntered(String d) {
              DateEntered = d;
          }
  
          public String getcDesc() {
              return cDesc;
          }
  
          public void setcDesc(String c) {
              cDesc = c;
          }
      }
  }
  </code></pre>
  
  <p>and APVoucher_batchgrid.fxml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import java.net.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.geometry.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  
  &lt;AnchorPane id="AnchorPane" fx:id="batchlistform" prefHeight="400.0" prefWidth="600.0" styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="keystone.APVoucher_batchgridController"&gt;
    &lt;children&gt;
      &lt;BorderPane layoutX="0.0" layoutY="0.0" prefHeight="400.0" prefWidth="600.0"&gt;
        &lt;center&gt;
          &lt;AnchorPane prefHeight="-1.0" prefWidth="-1.0"&gt;
            &lt;children&gt;
              &lt;Pane layoutX="0.0" layoutY="0.0" prefHeight="53.0" prefWidth="580.0"&gt;
                &lt;children&gt;
                  &lt;Label layoutX="7.0" layoutY="9.0" prefWidth="202.0" text="AP Vouchers Batch List"&gt;
                    &lt;font&gt;
                      &lt;Font name="System Bold" size="14.0" /&gt;
                    &lt;/font&gt;
                  &lt;/Label&gt;
                  &lt;Button fx:id="btnClose" cancelButton="true" layoutX="513.0" layoutY="27.0" mnemonicParsing="false" text="Close" /&gt;
                  &lt;Button id="btnClose" fx:id="apvRefresh" cancelButton="true" layoutX="185.0" layoutY="27.0" mnemonicParsing="false" onAction="#opentables" text="Refresh" /&gt;
                &lt;/children&gt;
              &lt;/Pane&gt;
              &lt;TableView fx:id="tblMainList" layoutX="0.0" layoutY="53.0" prefHeight="323.0" prefWidth="580.0"&gt;
                &lt;columns&gt;
                  &lt;TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="91.0" text="Date Entered" fx:id="colDateEntered" /&gt;
                  &lt;TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Created By" fx:id="colCreatedBy" /&gt;
                  &lt;TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="261.0" text="Description" fx:id="colDescription" /&gt;
                &lt;/columns&gt;
              &lt;/TableView&gt;
            &lt;/children&gt;
          &lt;/AnchorPane&gt;
        &lt;/center&gt;
        &lt;padding&gt;
          &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /&gt;
        &lt;/padding&gt;
      &lt;/BorderPane&gt;
    &lt;/children&gt;
    &lt;stylesheets&gt;
      &lt;URL value="@apvoucher_batchgrid.css" /&gt;
    &lt;/stylesheets&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>THANK YOU for the answer.  Way to many years in case insensitive languages. This has been a quick and dirty exercise for me to learn java and the latest &amp; greatest stuff or as I like to say New Exciting Technology (NExT!)  </p>
  
  <p>For anyone looking at the answer and still not completely clued in, here are the changes that made the code work properly.</p>
  
  <pre><code>colDateEntered.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("Denteredon"));
  colDescription.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("CDesc"));
  colEnteredBy.setCellValueFactory(new PropertyValueFactory&lt;sresult, String&gt;("Ccreatedby"));
  
  
      public class sresult {
  
          private String Denteredon;
          private String Ccreatedby;
          private String CDesc;
  
          public sresult(String T, String d, String c) {
              this.Ccreatedby = T;
              this.Denteredon = d;
              this.CDesc = c;
          }
  
          public String getCcreatedby() {
              return Ccreatedby;
          }
  
          public void setCreatedby(String T) {
              Ccreatedby = T;
          }
  
          public String getDenteredon() {
              return Denteredon;
          }
  
          public void setDenteredon(String d) {
              Denteredon = d;
          }
  
          public String getCDesc() {
              return CDesc;
          }
  
          public void setCDesc(String c) {
              CDesc = c;
          }
      }
  }
  </code></pre>