Reputation: 776
I am populating a Table View from a database, in Javafx. But as soon as the rows show up, the buttons in the same tab with the Table View stop working and throw null pointer exceptions. If I leave the Table View empty, the buttons work fine. The errors occur on the lines with tableColumn...
, if I comment the first one out, the second one breaks and so on. Here's the code:
@Override
public void initialize(URL location, ResourceBundle resources) {
Collection<Reservierung> list;
Collection<Box> list1;
try {
list = service.listReservierung();
tableColumnReservNr.setCellValueFactory(new PropertyValueFactory<Reservierung, Integer>("reservNr"));
tableColumnReservName.setCellValueFactory(new PropertyValueFactory<Reservierung, String>("kundenName"));
tableColumnReservVon.setCellValueFactory(new PropertyValueFactory<Reservierung, Timestamp>("von"));
tableColumnReservBis.setCellValueFactory(new PropertyValueFactory<Reservierung, Timestamp>("bis"));
AlleReservTable.getItems().setAll(list);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Upvotes: 1
Views: 68