D
D
ddddd tttt2016-12-10 16:38:51
Java
ddddd tttt, 2016-12-10 16:38:51

Why is the column not visible in the tableView?

Fields:

private final SimpleIntegerProperty raceKod;
    private final SimpleStringProperty raceDate;
    private final SimpleStringProperty repartureDate;
    private final SimpleIntegerProperty cost;
    private final SimpleIntegerProperty tourKod;

No raceKod output. Although in the console everything is fine.
static void selectStart(ResultSet rs,String table) {
        try {
            bd_interface.label3.setText(table);
            ResultSetMetaData rsmd = rs.getMetaData();
            TableColumn tableColumn1 = new TableColumn(rsmd.getColumnName(1));
            TableColumn tableColumn2 = new TableColumn(rsmd.getColumnName(2));
            TableColumn tableColumn3 = new TableColumn(rsmd.getColumnName(3));
            TableColumn tableColumn4 = new TableColumn(rsmd.getColumnName(4));
            TableColumn tableColumn5 = new TableColumn(rsmd.getColumnName(5));
            tableColumn1.setCellValueFactory(new PropertyValueFactory<Client, Date>("raceDate"));
            tableColumn2.setCellValueFactory(new PropertyValueFactory<Client, Date>("repartureDate"));
            tableColumn3.setCellValueFactory(new PropertyValueFactory<Client, Integer>("cost"));
            tableColumn4.setCellValueFactory(new PropertyValueFactory<Client, Integer>("raceKod"));
            tableColumn5.setCellValueFactory(new PropertyValueFactory<Client, Integer>("tourKod"));
            ObservableList<Race> data = FXCollections.observableArrayList();
            while (rs.next()) {
                data.add(new Race(rs.getDate(1), rs.getDate(2), rs.getInt(3), rs.getInt(4), rs.getInt(5)));
            }
            System.out.println(data.get(0).raceKod);
            System.out.println(data.get(1).raceKod);
            bd_interface.tableView.getColumns().clear();
            bd_interface.tableView.setItems(data);
            bd_interface.tableView.getColumns().addAll(tableColumn1, tableColumn2, tableColumn3, tableColumn4,tableColumn5);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question