JavaFX: TableView not showing up in GUI
<p>I am attempting to bind my program to the GUI designed in SceneBuilder.
I have managed to get my 'Accounts.class' ID's displayed as wanted in the far left list.</p>

<p>Now I need to get the TableView working but I am having no luck getting it to populate with data.</p>

<p>It should contain data from the fields of 'Invoice.class',
Inside each Account object there is an Set - this set will be displayed on different rows in the right TableView.</p>

<p>Any help is greatly appreciated !</p>

<p>p.s. forgive me I know it has been asked many times before but all the other solutions seem to not work for me I have tried adding the type in the parameter like;</p>

<pre><code>  tableAccount.setCellValueFactory(new PropertyValueFactory&lt;Invoice, Account&gt;("id"));
</code></pre>

<p>Having no luck with this getting really frustrated. I have messed around since last night with no improvements at all so posting here was my last resort.</p>

<p><strong>Controller.class</strong></p>

<pre><code>public class Controller implements Initializable{
    final ObservableList&lt;Account&gt; tableContent = FXCollections.observableArrayList(new Account("A", "B"));
    @FXML
    private TableView&lt;?&gt; tableView;
    @FXML
    private TableColumn&lt;?, ?&gt; tableAccount;
    @FXML
    private TableColumn&lt;?, ?&gt; tableDate;
    @FXML
    private TableColumn&lt;?, ?&gt; tableTime;
    @FXML
    private TableColumn&lt;?, ?&gt; tableTotal;
    @FXML
    private TableColumn&lt;?, ?&gt; tableNotes;
    @FXML
    private ListView&lt;String&gt; list;
    @FXML
    private TextArea invoiceView;
    @FXML
    private TextField amountField;
    @FXML
    private Button addAmount;
    @FXML
    private Button newInvoice;
    @FXML
    private Button saveInvoice;
    @FXML
    private Button deleteInvoice;
    @FXML
    private Label messageBar;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        //list.setPlaceholder(new Label("No Content In List"));

        setAccountsList();
        //tableView = new TableView&lt;&gt;(names);
        Account ac1 = new Account("A-02", "Tina", "96 Grove Vale", "London", "N1 8PT");
        Invoice inv = ac1.newInvoice();
        InvoiceCalculator calc = new InvoiceCalculator();
        inv.add(4.50);
        inv.add(4.50);
        inv.add(3.00);
        inv.add(15.00);
        calc.calculateInvoice(inv);

        setTableView(ac1);


    }

    private void setTableView(Account a) {
        tableView = new TableView&lt;&gt;();
        tableAccount.setCellValueFactory(new PropertyValueFactory&lt;&gt;("id"));
        tableDate.setCellValueFactory(new PropertyValueFactory&lt;&gt;("date"));
        tableTime.setCellValueFactory(new PropertyValueFactory&lt;&gt;("time"));
        tableTotal.setCellValueFactory(new PropertyValueFactory&lt;&gt;("total"));
        tableNotes.setCellValueFactory(new PropertyValueFactory&lt;&gt;("notes"));

        //tableView.setItems(setTableAccounts());
    }

    @FXML
    public void listViewSelected() {
        list.getSelectionModel().getSelectedItem();
       // newInvoice.setText(list.getSelectionModel().getSelectedItem());
    }

    @FXML
    public void newInvoiceFired() {
        System.out.println("new invoice button has been clicked");
    }

    @FXML
    public void deleteInvoiceFired() {
        System.out.println("delete invoice button has been clicked");

    }
    @FXML
    public void saveInvoiceFired() {
        System.out.println("save invoice button has been clicked");

    }

    public void setAccountsList(){
        ObservableList&lt;String&gt; names = FXCollections.observableArrayList();
        names.addAll(Main.getAllAccounts().stream().map(Account::getId).collect(Collectors.toList()));
        list.setItems(names);
        names.add("T-112");
    }

    public ObservableList&lt;Account&gt; setTableAccounts(){
        ObservableList&lt;Account&gt; names = FXCollections.observableArrayList();
        names.addAll(Main.getAllAccounts());
        return names;
    }

}
</code></pre>

<p><strong>Account.class</strong></p>

<pre><code>public class Account {
    private String id;
    private String name;
    private String address1;
    private String address2;
    private String postCode;
    private Set&lt;Invoice&gt; invoiceArchive = new HashSet&lt;&gt;();

    public Account(String id, String name, String address1, String address2, String postCode) {
        this.id = id;
        this.name = name;
        this.address1 = address1;
        this.address2 = address2;
        this.postCode = postCode;
        Main.addAccount(this);
    }

    public Account(String id, String name, String address1, String postCode) {
        this.id = id;
        this.name = name;
        this.address1 = address1;
        this.postCode = postCode;
    }

    public Account(String name, String id) {
        this.name = name;
        this.id = id;
    }

    public String getId() {

        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress1() {
        return address1;
    }

    public void setAddress1(String address1) {
        this.address1 = address1;
    }

    public String getAddress2() {
        return address2;
    }

    public void setAddress2(String address2) {
        this.address2 = address2;
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode;
    }

    public Set&lt;Invoice&gt; getInvoiceArchive() {
        return invoiceArchive;
    }

    public Invoice newInvoice(){
        Invoice i = new Invoice(this);
        invoiceArchive.add(i);
        return i;
    }

    @Override
    public String toString(){
        return this.getId();
    }
}
</code></pre>

<p><strong>Invoice.class</strong></p>

<pre><code>public class Invoice {
    private Account id;
    private ArrayList&lt;Double&gt; invoiceAmounts;
    private double invoiceTotal;
    private String date;
    private String time;
    private String notes;
    private String modified;
    DecimalFormat df = new DecimalFormat("#.00");



    public Invoice(Account id) {
        this.id = id;
        this.invoiceAmounts = new ArrayList&lt;&gt;();
        this.date = new SimpleDateFormat("dd/MM/yyyy HH:mm").format(Calendar.getInstance().getTime());
    }

    public String getDate() {
        return date;
    }

    public void setModified(String date) {
        this.modified = date;
    }

    public Account getId() {
        return id;
    }

    public void setId(Account id) {
        this.id = id;
    }

    public ArrayList&lt;Double&gt; getInvoiceAmounts() {
        return invoiceAmounts;
    }

    public void setInvoiceAmounts(ArrayList&lt;Double&gt; invoiceAmounts) {
        this.invoiceAmounts = invoiceAmounts;
    }

    public double getInvoiceTotal() {
        return invoiceTotal;
    }

    public void setInvoiceTotal(double invoiceTotal) {
        this.invoiceTotal = invoiceTotal;
    }

    public void add(Double d){
        invoiceAmounts.add(d);
    }

    private String returnInvoiceAmounts(){
        String result="";
        for (Double d:invoiceAmounts){
            result += "£"+df.format(d)+"\n";
        }
        return result;
    }

    @Override
    public String toString(){
        return "Account: "+id.getId()+
                "\nCreated: "+getDate()+"\n"+returnInvoiceAmounts()
                +"--------"+"\nTotal\n£"+df.format(invoiceTotal);
    }
}
</code></pre>

<p><strong>GUI.fxml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;?import javafx.scene.control.Button?&gt;
&lt;?import javafx.scene.control.Label?&gt;
&lt;?import javafx.scene.control.ListView?&gt;
&lt;?import javafx.scene.control.SplitPane?&gt;
&lt;?import javafx.scene.control.TableColumn?&gt;
&lt;?import javafx.scene.control.TableView?&gt;
&lt;?import javafx.scene.control.TextArea?&gt;
&lt;?import javafx.scene.control.TextField?&gt;
&lt;?import javafx.scene.image.Image?&gt;
&lt;?import javafx.scene.image.ImageView?&gt;
&lt;?import javafx.scene.layout.AnchorPane?&gt;
&lt;?import javafx.scene.layout.HBox?&gt;

&lt;AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="477.0" prefWidth="641.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller"&gt;
   &lt;children&gt;
      &lt;SplitPane dividerPositions="0.24249999999999972" layoutY="50.0" prefHeight="427.0" prefWidth="641.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0"&gt;
        &lt;items&gt;
          &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"&gt;
               &lt;children&gt;
                  &lt;ListView fx:id="list" layoutX="-24.0" layoutY="62.0" onKeyPressed="#listViewSelected" onKeyReleased="#listViewSelected" onMouseClicked="#listViewSelected" prefHeight="425.0" prefWidth="151.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /&gt;
               &lt;/children&gt;
            &lt;/AnchorPane&gt;
          &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="445.0" prefWidth="411.0"&gt;
               &lt;children&gt;
                  &lt;SplitPane dividerPositions="0.30023640661938533" layoutX="143.0" layoutY="123.0" orientation="VERTICAL" prefHeight="445.0" prefWidth="480.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                    &lt;items&gt;
                      &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0"&gt;
                           &lt;children&gt;
                              &lt;TableView layoutX="128.0" layoutY="45.0" prefHeight="208.0" prefWidth="478.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                                &lt;columns&gt;
                                    &lt;TableColumn fx:id="tableAccount" prefWidth="75.0" text="Account" /&gt;
                                  &lt;TableColumn fx:id="tableDate" prefWidth="75.0" text="Date" /&gt;
                                  &lt;TableColumn fx:id="tableTime" prefWidth="75.0" text="Time" /&gt;
                                    &lt;TableColumn fx:id="tableTotal" prefWidth="75.0" text="Amount" /&gt;
                                    &lt;TableColumn fx:id="tableNotes" prefWidth="75.0" text="Notes" /&gt;
                                &lt;/columns&gt;
                              &lt;/TableView&gt;
                           &lt;/children&gt;
                        &lt;/AnchorPane&gt;
                      &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="286.0" prefWidth="478.0"&gt;
                           &lt;children&gt;
                              &lt;SplitPane dividerPositions="0.4474789915966387" layoutX="168.0" layoutY="48.0" prefHeight="292.0" prefWidth="478.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                                &lt;items&gt;
                                  &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"&gt;
                                       &lt;children&gt;
                                          &lt;TextArea fx:id="invoiceView" layoutX="5.0" layoutY="14.0" prefHeight="290.0" prefWidth="209.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /&gt;
                                       &lt;/children&gt;
                                    &lt;/AnchorPane&gt;
                                  &lt;AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"&gt;
                                       &lt;children&gt;
                                          &lt;TextField fx:id="amountField" layoutX="82.0" layoutY="86.0" prefHeight="27.0" prefWidth="104.0" promptText="0.00" /&gt;
                                          &lt;Button fx:id="addAmount" layoutX="195.0" layoutY="86.0" mnemonicParsing="false" text="Add" /&gt;
                                          &lt;Label layoutX="14.0" layoutY="91.0" text="Amount: : " /&gt;
                                       &lt;/children&gt;
                                    &lt;/AnchorPane&gt;
                                &lt;/items&gt;
                              &lt;/SplitPane&gt;
                           &lt;/children&gt;
                        &lt;/AnchorPane&gt;
                    &lt;/items&gt;
                  &lt;/SplitPane&gt;
               &lt;/children&gt;
            &lt;/AnchorPane&gt;
        &lt;/items&gt;
      &lt;/SplitPane&gt;
      &lt;ImageView fitHeight="150.0" fitWidth="200.0" layoutX="14.0" layoutY="11.0" pickOnBounds="true" preserveRatio="true"&gt;
         &lt;image&gt;
            &lt;Image url="@Icon/Logo.png" /&gt;
         &lt;/image&gt;
      &lt;/ImageView&gt;
      &lt;HBox alignment="CENTER_RIGHT" layoutX="462.0" layoutY="14.0" spacing="15.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0"&gt;
         &lt;children&gt;
            &lt;Button fx:id="newInvoice" mnemonicParsing="false" onAction="#newInvoiceFired" text="New" /&gt;
            &lt;Button fx:id="saveInvoice" mnemonicParsing="false" onAction="#deleteInvoiceFired" text="Save" /&gt;
            &lt;Button fx:id="deleteInvoice" mnemonicParsing="false" onAction="#deleteInvoiceFired" text="Delete" /&gt;
         &lt;/children&gt;
      &lt;/HBox&gt;
   &lt;/children&gt;
&lt;/AnchorPane&gt;
</code></pre>

<p><a href="http://i.stack.imgur.com/72enr.png" rel="nofollow">** GUI Display **</a></p>