我想创建一个包含两列的TableView。第一个包含Requirement Class中的SimpleStringProperty。第二个应该使用Requirement Class中的数据保存ComboboxTableCell。该课程如下:
public class Requirement{
private SimpleStringProperty requirementTitle;
private ObservableList<Criteria> criteria = FXCollections.observableArrayList();
...getters and setters... }
public class Criteria{
private SimpleStringProperty criteriaTitle;
...getters and setters... }
public class CriteriaViewController {
@FXML
private TableView<Requirement> criteriaTable;
@FXML
private TableColumn<Requirement, String> requirementColumn;
@FXML
private TableColumn<Requirement, String> criteriaColumn;
public void initializeTable(){
requirementColumn.setCellValueFactory(new PropertyValueFactory<>("requirementTitle"));
criteriaColumn.setCellValueFactory(???);
criteriaColumn.setCellFactory(ComboBoxTableCell.forTableColumn(???));
}
我面临的问题是如何使用Requirement类中的Observablelist中的数据填充Combobox?如果有人可以帮助我,我会非常感激。