I'm trying to dynamically populate a TableView with arrays of strings taht I have inside of a list (I guess there are better ways to handle information, but its is what I was given to do...), so I create a tableView, create all the columns and stuff, but I'm lost at the moment of populating the tableview.
The list has all the string arrays inside and everything seems to work, there is no missplaced data on any array or anything like that, and when I run the project, the column names appear as I wanted them to, and there is a row on the tableview for every array on my list, but I just can't get it to display the information.
I guess I'm missing the statement to set the information from the list into the cells, but I can't see the way to do it. Any help will be thanked in its weight in cookies :0
Here's the code of the process im using so far.
int tam = regs.length-3;
String[] aux = new String[regs.length-3];
ObservableList<String[]> list = FXCollections.observableArrayList();
for (int i = 0; i < db.length; i++) {
aux[(i % tam)] = db[i];
if (((i % tam) == tam-1) & (i > 0)) {
list.add(aux);
aux = new String[tam];
}
}
TableView<String[]> table = new TableView<>();
TableColumn[] tableColumns = new TableColumn[tam];
for (int i = 3; i < regs.length; i++) {
tableColumns[i-3] = new TableColumn(regs[i]);
}
table.getColumns().addAll(tableColumns);
table.setItems(list);