Hello i have an issue i am trying to display data from database into a TableView using Java because i couldn't find in JavaFx anything like a DataGridView in C#.
I made the following method to fill the table:
private void fillTableView() throws SQLException {
        // fill header      
        for (int i = 2; i <= resultSet.getMetaData().getColumnCount(); i++) {
            TableColumn column = new TableColumn(resultSet.getMetaData().getColumnName(i));
            tableView.getColumns().addAll(column);
        }       
        // fill rows
        while (resultSet.next()) { // loop through the rows by one
            ObservableList<String> row = FXCollections.observableArrayList();
            for (int i = 2; i <= resultSet.getMetaData().getColumnCount(); i++) { // loop through the cells of each row    
                // add the value of this cell to the valueToAdd string
                row.add(resultSet.getString(i));
            }
            tableView.getItems().add((row));
            //rows.add(rows);
        }
        //tableView.setItems(rows);
    }
The first part works good and the column names are visible however, the rows of data appear empty yet they could be selected, so i can select the first 5 rows in the TableView ( I have five rows in my ResultSet) but those rows appear empty. I tried to remove this part
tableView.getItems().add((row));
And instead un-comment the two lines of code below it but still it didn't work.
I tried to make objects initialized with the values from the database then add the objects to the TableView rather than adding an ObservableList of strings representing the rows as follows but still gave the same result (empty rows)
while (resultSet.next()) {
            Employee employee = new Employee(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3), resultSet.getString(4));
            tableView.getItems().add(employee);
        }
Can someone tell me what am i doing wrong please ?
I am using Netbeans 8, Scene builder, Java 8 and JavaDB (aka Apache Derby).
 
    