我的問題的解決方案是for
或while
使用此代碼來解析集合:
TableColumn<Person,String> firstNameCol = new TableColumn<Person,String>("First Name");
firstNameCol.setCellValueFactory(new Callback<CellDataFeatures<Person, String>, ObservableValue<String>>() {
public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
return p.getValue().firstNameProperty();
}
});
}
的爲例:
TableColumn columnmod = new TableColumn<ModuleNoteBean, Double>(
moBean.getModuleBean());
for (int i = 0; i < moBean.getListmat().size(); i++) {
TableColumn columnNote = new TableColumn(moBean.getList_mat()
.get(i));
final int index = i;
columnNote
.setCellValueFactory(new Callback<CellDataFeatures<ModuleNoteBean, String>, ObservableValue<String>>() {
public ObservableValue<String> call(
CellDataFeatures<ModuleNoteBean, String> p) {
SimpleStringProperty b = new SimpleStringProperty(p
.getValue().getModuleNList().get(0)
.getNoteList().get(index)
+ "");
return b;
}
});
PropertyValueFactory
什麼是確切的錯誤你是得到些什麼? – greedybuddha