无法在 javafx 应用程序中获取 ComboboxTableCell

Can't get ComboboxTableCell in javafx app

我正在尝试为从数据库中获取的每条记录显示一个组合框,但不幸的是我无法在预期的列中获得任何组合框。

这是我的模型的代码 class:

public class Employee {
    private final int id;
    private final SimpleStringProperty ename;
    private final SimpleStringProperty ecnic;
    private final SimpleDoubleProperty ebalance;
    private final SimpleDoubleProperty etotalpaid;
    private SimpleStringProperty estatus;
    public Employee(int id, String ename, String ecnic, Double ebalance,
            Double etotalpaid, String estatus) {
        super();
        this.id = id;
        this.ename = new SimpleStringProperty(ename);
        this.ecnic = new SimpleStringProperty(ecnic);
        this.ebalance = new SimpleDoubleProperty(ebalance);
        this.etotalpaid = new SimpleDoubleProperty(etotalpaid);
        this.estatus = new SimpleStringProperty(estatus);
    }
    public String getEstatusproperty() {
        return estatus.get();
    }
    public String getEstatus() {
        return estatus.get();
    }
    public void setEstatus(String estatus) {
        this.estatus = new SimpleStringProperty(estatus);
    }
    public int getId() {
        return id;
    }
    public String getEname() {
        return ename.get();
    }
    public String getEcnic() {
        return ecnic.get();
    }
    public Double getEbalance() {
        return ebalance.get();
    }
    public Double getEtotalpaid() {
        return etotalpaid.get();
    }
}

这是我调用以从数据库中获取数据的方法的代码..

    public void attendence() throws SQLException{
        employeelist = FXCollections.observableArrayList();
        ename.setCellValueFactory(new PropertyValueFactory<Employee,String>("ename"));
        ecnic.setCellValueFactory(new PropertyValueFactory<Employee,String>("ecnic"));
        ebalance.setCellValueFactory(new PropertyValueFactory<Employee,Double>("ebalance"));
        etotalpaid.setCellValueFactory(new PropertyValueFactory<Employee,Double>("etotalpaid"));
        estatus.setCellValueFactory(new PropertyValueFactory<Employee,String>("estatus"));
        estatus.setCellFactory(ComboBoxTableCell.forTableColumn(new DefaultStringConverter(), attendenceoptions));
        estatus.setOnEditCommit(
                new EventHandler<CellEditEvent<Employee, String>>() {
                    @Override
                    public void handle(CellEditEvent<Employee, String> t) {
                        ((Employee) t.getTableView().getItems().get(t.getTablePosition().getRow())).setEstatus(t.getNewValue());
                    };
        });
        estatus.setEditable(true);
        stmt = conn.createStatement();
        sql = "select * from  employe";
        rs = stmt.executeQuery(sql);
        while(rs.next()){
            employeelist.add(new Employee(rs.getInt(1),rs.getString(2),rs.getString(3),rs.getDouble(5),rs.getDouble(6),"Present"));
            employeetable.setItems(employeelist);
        }
        stmt.close();
        rs.close();
    }
}

在解决问题的方法中添加了这个。

employeetable.setEditable(true);