Javafx tableview not showing data in all columns












11















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.



APVoucher_batchgridController.java



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<sresult, String>("DateEntered"));

colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("cDesc"));

colCreatedBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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<Object> 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;
}
}
}


and APVoucher_batchgrid.fxml



<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>

<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">
<children>
<BorderPane layoutX="0.0" layoutY="0.0" prefHeight="400.0" prefWidth="600.0">
<center>
<AnchorPane prefHeight="-1.0" prefWidth="-1.0">
<children>
<Pane layoutX="0.0" layoutY="0.0" prefHeight="53.0" prefWidth="580.0">
<children>
<Label layoutX="7.0" layoutY="9.0" prefWidth="202.0" text="AP Vouchers Batch List">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Button fx:id="btnClose" cancelButton="true" layoutX="513.0" layoutY="27.0" mnemonicParsing="false" text="Close" />
<Button id="btnClose" fx:id="apvRefresh" cancelButton="true" layoutX="185.0" layoutY="27.0" mnemonicParsing="false" onAction="#opentables" text="Refresh" />
</children>
</Pane>
<TableView fx:id="tblMainList" layoutX="0.0" layoutY="53.0" prefHeight="323.0" prefWidth="580.0">
<columns>
<TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="91.0" text="Date Entered" fx:id="colDateEntered" />
<TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Created By" fx:id="colCreatedBy" />
<TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="261.0" text="Description" fx:id="colDescription" />
</columns>
</TableView>
</children>
</AnchorPane>
</center>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</BorderPane>
</children>
<stylesheets>
<URL value="@apvoucher_batchgrid.css" />
</stylesheets>
</AnchorPane>


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 & greatest stuff or as I like to say New Exciting Technology (NExT!)



For anyone looking at the answer and still not completely clued in, here are the changes that made the code work properly.



colDateEntered.setCellValueFactory(new PropertyValueFactory<sresult, String>("Denteredon"));
colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("CDesc"));
colEnteredBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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;
}
}
}









share|improve this question





























    11















    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.



    APVoucher_batchgridController.java



    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<sresult, String>("DateEntered"));

    colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("cDesc"));

    colCreatedBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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<Object> 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;
    }
    }
    }


    and APVoucher_batchgrid.fxml



    <?xml version="1.0" encoding="UTF-8"?>

    <?import java.lang.*?>
    <?import java.net.*?>
    <?import java.util.*?>
    <?import javafx.geometry.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.text.*?>

    <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">
    <children>
    <BorderPane layoutX="0.0" layoutY="0.0" prefHeight="400.0" prefWidth="600.0">
    <center>
    <AnchorPane prefHeight="-1.0" prefWidth="-1.0">
    <children>
    <Pane layoutX="0.0" layoutY="0.0" prefHeight="53.0" prefWidth="580.0">
    <children>
    <Label layoutX="7.0" layoutY="9.0" prefWidth="202.0" text="AP Vouchers Batch List">
    <font>
    <Font name="System Bold" size="14.0" />
    </font>
    </Label>
    <Button fx:id="btnClose" cancelButton="true" layoutX="513.0" layoutY="27.0" mnemonicParsing="false" text="Close" />
    <Button id="btnClose" fx:id="apvRefresh" cancelButton="true" layoutX="185.0" layoutY="27.0" mnemonicParsing="false" onAction="#opentables" text="Refresh" />
    </children>
    </Pane>
    <TableView fx:id="tblMainList" layoutX="0.0" layoutY="53.0" prefHeight="323.0" prefWidth="580.0">
    <columns>
    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="91.0" text="Date Entered" fx:id="colDateEntered" />
    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Created By" fx:id="colCreatedBy" />
    <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="261.0" text="Description" fx:id="colDescription" />
    </columns>
    </TableView>
    </children>
    </AnchorPane>
    </center>
    <padding>
    <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
    </padding>
    </BorderPane>
    </children>
    <stylesheets>
    <URL value="@apvoucher_batchgrid.css" />
    </stylesheets>
    </AnchorPane>


    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 & greatest stuff or as I like to say New Exciting Technology (NExT!)



    For anyone looking at the answer and still not completely clued in, here are the changes that made the code work properly.



    colDateEntered.setCellValueFactory(new PropertyValueFactory<sresult, String>("Denteredon"));
    colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("CDesc"));
    colEnteredBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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;
    }
    }
    }









    share|improve this question



























      11












      11








      11


      8






      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.



      APVoucher_batchgridController.java



      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<sresult, String>("DateEntered"));

      colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("cDesc"));

      colCreatedBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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<Object> 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;
      }
      }
      }


      and APVoucher_batchgrid.fxml



      <?xml version="1.0" encoding="UTF-8"?>

      <?import java.lang.*?>
      <?import java.net.*?>
      <?import java.util.*?>
      <?import javafx.geometry.*?>
      <?import javafx.scene.*?>
      <?import javafx.scene.control.*?>
      <?import javafx.scene.layout.*?>
      <?import javafx.scene.text.*?>

      <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">
      <children>
      <BorderPane layoutX="0.0" layoutY="0.0" prefHeight="400.0" prefWidth="600.0">
      <center>
      <AnchorPane prefHeight="-1.0" prefWidth="-1.0">
      <children>
      <Pane layoutX="0.0" layoutY="0.0" prefHeight="53.0" prefWidth="580.0">
      <children>
      <Label layoutX="7.0" layoutY="9.0" prefWidth="202.0" text="AP Vouchers Batch List">
      <font>
      <Font name="System Bold" size="14.0" />
      </font>
      </Label>
      <Button fx:id="btnClose" cancelButton="true" layoutX="513.0" layoutY="27.0" mnemonicParsing="false" text="Close" />
      <Button id="btnClose" fx:id="apvRefresh" cancelButton="true" layoutX="185.0" layoutY="27.0" mnemonicParsing="false" onAction="#opentables" text="Refresh" />
      </children>
      </Pane>
      <TableView fx:id="tblMainList" layoutX="0.0" layoutY="53.0" prefHeight="323.0" prefWidth="580.0">
      <columns>
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="91.0" text="Date Entered" fx:id="colDateEntered" />
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Created By" fx:id="colCreatedBy" />
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="261.0" text="Description" fx:id="colDescription" />
      </columns>
      </TableView>
      </children>
      </AnchorPane>
      </center>
      <padding>
      <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
      </padding>
      </BorderPane>
      </children>
      <stylesheets>
      <URL value="@apvoucher_batchgrid.css" />
      </stylesheets>
      </AnchorPane>


      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 & greatest stuff or as I like to say New Exciting Technology (NExT!)



      For anyone looking at the answer and still not completely clued in, here are the changes that made the code work properly.



      colDateEntered.setCellValueFactory(new PropertyValueFactory<sresult, String>("Denteredon"));
      colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("CDesc"));
      colEnteredBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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;
      }
      }
      }









      share|improve this question
















      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.



      APVoucher_batchgridController.java



      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<sresult, String>("DateEntered"));

      colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("cDesc"));

      colCreatedBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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<Object> 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;
      }
      }
      }


      and APVoucher_batchgrid.fxml



      <?xml version="1.0" encoding="UTF-8"?>

      <?import java.lang.*?>
      <?import java.net.*?>
      <?import java.util.*?>
      <?import javafx.geometry.*?>
      <?import javafx.scene.*?>
      <?import javafx.scene.control.*?>
      <?import javafx.scene.layout.*?>
      <?import javafx.scene.text.*?>

      <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">
      <children>
      <BorderPane layoutX="0.0" layoutY="0.0" prefHeight="400.0" prefWidth="600.0">
      <center>
      <AnchorPane prefHeight="-1.0" prefWidth="-1.0">
      <children>
      <Pane layoutX="0.0" layoutY="0.0" prefHeight="53.0" prefWidth="580.0">
      <children>
      <Label layoutX="7.0" layoutY="9.0" prefWidth="202.0" text="AP Vouchers Batch List">
      <font>
      <Font name="System Bold" size="14.0" />
      </font>
      </Label>
      <Button fx:id="btnClose" cancelButton="true" layoutX="513.0" layoutY="27.0" mnemonicParsing="false" text="Close" />
      <Button id="btnClose" fx:id="apvRefresh" cancelButton="true" layoutX="185.0" layoutY="27.0" mnemonicParsing="false" onAction="#opentables" text="Refresh" />
      </children>
      </Pane>
      <TableView fx:id="tblMainList" layoutX="0.0" layoutY="53.0" prefHeight="323.0" prefWidth="580.0">
      <columns>
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="91.0" text="Date Entered" fx:id="colDateEntered" />
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" text="Created By" fx:id="colCreatedBy" />
      <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="261.0" text="Description" fx:id="colDescription" />
      </columns>
      </TableView>
      </children>
      </AnchorPane>
      </center>
      <padding>
      <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
      </padding>
      </BorderPane>
      </children>
      <stylesheets>
      <URL value="@apvoucher_batchgrid.css" />
      </stylesheets>
      </AnchorPane>


      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 & greatest stuff or as I like to say New Exciting Technology (NExT!)



      For anyone looking at the answer and still not completely clued in, here are the changes that made the code work properly.



      colDateEntered.setCellValueFactory(new PropertyValueFactory<sresult, String>("Denteredon"));
      colDescription.setCellValueFactory(new PropertyValueFactory<sresult, String>("CDesc"));
      colEnteredBy.setCellValueFactory(new PropertyValueFactory<sresult, String>("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;
      }
      }
      }






      javafx tableview






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 24 '13 at 12:48







      Keith_Indy

















      asked Sep 24 '13 at 0:33









      Keith_IndyKeith_Indy

      58116




      58116
























          2 Answers
          2






          active

          oldest

          votes


















          36














          This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I'll specifically address your specific case, so it's clear.



          Background



          PropertyValueFactory uses reflection to determine the methods to get and set data values as well as to retrieve bindable properties from your model class. The pattern followed is:



          PropertyValueType getName()
          void setName(PropertyValueType value)
          PropertyType nameProperty()


          Where "name" is the string specified in the PropertyValueFactory constructor. The first letter of the property name in the getter and setter is capitalized (by java bean naming convention).



          Why your application doesn't work



          You have these three expressions:



          new PropertyValueFactory<sresult, String>("DateEntered")
          new PropertyValueFactory<sresult, String>("cDesc")
          new PropertyValueFactory<sresult, String>("CreatedBy")


          For your sample properties, the PropertyValueFactory will look for these methods:



          "DateEntered" => getDateEntered()
          "cDesc" => getCDesc()
          "CreatedBy" => getCreatedBy()


          And you have these three getters on your sresult class:



          getDateEntered()
          getcDesc()
          getEnteredBy()


          Only getDateEntered() is going to be picked up by the PropertyValueFactory because that is the only matching method defined in the sresult class.



          Advice



          You will have to adopt Java standards if you want the reflection in PropertyValueFactory to work (the alternative is to not use the PropertyValueFactory and instead write your own cell factories from scratch).



          Adopting Java camel case naming conventions also makes it easier for Java developers to read your code.






          share|improve this answer


























          • @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

            – Osama Al-Banna
            Mar 30 '17 at 9:06













          • You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

            – trilogy
            Jan 8 at 20:49



















          0














          For anyone else who still wasn't getting it after going through the above, my problem was that I wasn't specifying my setters with the "public final" designation.






          share|improve this answer



















          • 2





            not entirely certain what you mean - but there's no need for a "final" modifier ..

            – kleopatra
            Jan 12 '18 at 12:43











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18971109%2fjavafx-tableview-not-showing-data-in-all-columns%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          36














          This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I'll specifically address your specific case, so it's clear.



          Background



          PropertyValueFactory uses reflection to determine the methods to get and set data values as well as to retrieve bindable properties from your model class. The pattern followed is:



          PropertyValueType getName()
          void setName(PropertyValueType value)
          PropertyType nameProperty()


          Where "name" is the string specified in the PropertyValueFactory constructor. The first letter of the property name in the getter and setter is capitalized (by java bean naming convention).



          Why your application doesn't work



          You have these three expressions:



          new PropertyValueFactory<sresult, String>("DateEntered")
          new PropertyValueFactory<sresult, String>("cDesc")
          new PropertyValueFactory<sresult, String>("CreatedBy")


          For your sample properties, the PropertyValueFactory will look for these methods:



          "DateEntered" => getDateEntered()
          "cDesc" => getCDesc()
          "CreatedBy" => getCreatedBy()


          And you have these three getters on your sresult class:



          getDateEntered()
          getcDesc()
          getEnteredBy()


          Only getDateEntered() is going to be picked up by the PropertyValueFactory because that is the only matching method defined in the sresult class.



          Advice



          You will have to adopt Java standards if you want the reflection in PropertyValueFactory to work (the alternative is to not use the PropertyValueFactory and instead write your own cell factories from scratch).



          Adopting Java camel case naming conventions also makes it easier for Java developers to read your code.






          share|improve this answer


























          • @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

            – Osama Al-Banna
            Mar 30 '17 at 9:06













          • You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

            – trilogy
            Jan 8 at 20:49
















          36














          This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I'll specifically address your specific case, so it's clear.



          Background



          PropertyValueFactory uses reflection to determine the methods to get and set data values as well as to retrieve bindable properties from your model class. The pattern followed is:



          PropertyValueType getName()
          void setName(PropertyValueType value)
          PropertyType nameProperty()


          Where "name" is the string specified in the PropertyValueFactory constructor. The first letter of the property name in the getter and setter is capitalized (by java bean naming convention).



          Why your application doesn't work



          You have these three expressions:



          new PropertyValueFactory<sresult, String>("DateEntered")
          new PropertyValueFactory<sresult, String>("cDesc")
          new PropertyValueFactory<sresult, String>("CreatedBy")


          For your sample properties, the PropertyValueFactory will look for these methods:



          "DateEntered" => getDateEntered()
          "cDesc" => getCDesc()
          "CreatedBy" => getCreatedBy()


          And you have these three getters on your sresult class:



          getDateEntered()
          getcDesc()
          getEnteredBy()


          Only getDateEntered() is going to be picked up by the PropertyValueFactory because that is the only matching method defined in the sresult class.



          Advice



          You will have to adopt Java standards if you want the reflection in PropertyValueFactory to work (the alternative is to not use the PropertyValueFactory and instead write your own cell factories from scratch).



          Adopting Java camel case naming conventions also makes it easier for Java developers to read your code.






          share|improve this answer


























          • @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

            – Osama Al-Banna
            Mar 30 '17 at 9:06













          • You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

            – trilogy
            Jan 8 at 20:49














          36












          36








          36







          This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I'll specifically address your specific case, so it's clear.



          Background



          PropertyValueFactory uses reflection to determine the methods to get and set data values as well as to retrieve bindable properties from your model class. The pattern followed is:



          PropertyValueType getName()
          void setName(PropertyValueType value)
          PropertyType nameProperty()


          Where "name" is the string specified in the PropertyValueFactory constructor. The first letter of the property name in the getter and setter is capitalized (by java bean naming convention).



          Why your application doesn't work



          You have these three expressions:



          new PropertyValueFactory<sresult, String>("DateEntered")
          new PropertyValueFactory<sresult, String>("cDesc")
          new PropertyValueFactory<sresult, String>("CreatedBy")


          For your sample properties, the PropertyValueFactory will look for these methods:



          "DateEntered" => getDateEntered()
          "cDesc" => getCDesc()
          "CreatedBy" => getCreatedBy()


          And you have these three getters on your sresult class:



          getDateEntered()
          getcDesc()
          getEnteredBy()


          Only getDateEntered() is going to be picked up by the PropertyValueFactory because that is the only matching method defined in the sresult class.



          Advice



          You will have to adopt Java standards if you want the reflection in PropertyValueFactory to work (the alternative is to not use the PropertyValueFactory and instead write your own cell factories from scratch).



          Adopting Java camel case naming conventions also makes it easier for Java developers to read your code.






          share|improve this answer















          This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I'll specifically address your specific case, so it's clear.



          Background



          PropertyValueFactory uses reflection to determine the methods to get and set data values as well as to retrieve bindable properties from your model class. The pattern followed is:



          PropertyValueType getName()
          void setName(PropertyValueType value)
          PropertyType nameProperty()


          Where "name" is the string specified in the PropertyValueFactory constructor. The first letter of the property name in the getter and setter is capitalized (by java bean naming convention).



          Why your application doesn't work



          You have these three expressions:



          new PropertyValueFactory<sresult, String>("DateEntered")
          new PropertyValueFactory<sresult, String>("cDesc")
          new PropertyValueFactory<sresult, String>("CreatedBy")


          For your sample properties, the PropertyValueFactory will look for these methods:



          "DateEntered" => getDateEntered()
          "cDesc" => getCDesc()
          "CreatedBy" => getCreatedBy()


          And you have these three getters on your sresult class:



          getDateEntered()
          getcDesc()
          getEnteredBy()


          Only getDateEntered() is going to be picked up by the PropertyValueFactory because that is the only matching method defined in the sresult class.



          Advice



          You will have to adopt Java standards if you want the reflection in PropertyValueFactory to work (the alternative is to not use the PropertyValueFactory and instead write your own cell factories from scratch).



          Adopting Java camel case naming conventions also makes it easier for Java developers to read your code.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 23 '17 at 12:18









          Community

          11




          11










          answered Sep 24 '13 at 6:20









          jewelseajewelsea

          112k8265318




          112k8265318













          • @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

            – Osama Al-Banna
            Mar 30 '17 at 9:06













          • You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

            – trilogy
            Jan 8 at 20:49



















          • @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

            – Osama Al-Banna
            Mar 30 '17 at 9:06













          • You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

            – trilogy
            Jan 8 at 20:49

















          @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

          – Osama Al-Banna
          Mar 30 '17 at 9:06







          @jewelsea can you explain how to create my cell factories ? this my question and I'm struggling here since a week stackoverflow.com/questions/43099841/… the program run without an error and does not show up the data in the table !!

          – Osama Al-Banna
          Mar 30 '17 at 9:06















          You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

          – trilogy
          Jan 8 at 20:49





          You don't have to create your own cell value factories, just set the col.setCellValueFactory(features -> features.getValue().colProperty()); if your properties are exposed by the model class.

          – trilogy
          Jan 8 at 20:49













          0














          For anyone else who still wasn't getting it after going through the above, my problem was that I wasn't specifying my setters with the "public final" designation.






          share|improve this answer



















          • 2





            not entirely certain what you mean - but there's no need for a "final" modifier ..

            – kleopatra
            Jan 12 '18 at 12:43
















          0














          For anyone else who still wasn't getting it after going through the above, my problem was that I wasn't specifying my setters with the "public final" designation.






          share|improve this answer



















          • 2





            not entirely certain what you mean - but there's no need for a "final" modifier ..

            – kleopatra
            Jan 12 '18 at 12:43














          0












          0








          0







          For anyone else who still wasn't getting it after going through the above, my problem was that I wasn't specifying my setters with the "public final" designation.






          share|improve this answer













          For anyone else who still wasn't getting it after going through the above, my problem was that I wasn't specifying my setters with the "public final" designation.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 10 '17 at 23:36









          Zachary BennettZachary Bennett

          443613




          443613








          • 2





            not entirely certain what you mean - but there's no need for a "final" modifier ..

            – kleopatra
            Jan 12 '18 at 12:43














          • 2





            not entirely certain what you mean - but there's no need for a "final" modifier ..

            – kleopatra
            Jan 12 '18 at 12:43








          2




          2





          not entirely certain what you mean - but there's no need for a "final" modifier ..

          – kleopatra
          Jan 12 '18 at 12:43





          not entirely certain what you mean - but there's no need for a "final" modifier ..

          – kleopatra
          Jan 12 '18 at 12:43


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18971109%2fjavafx-tableview-not-showing-data-in-all-columns%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen