【发布时间】:2017-07-23 13:19:47
【问题描述】:
TableColumn<ComponentObject, Hyperlink> template_id = new TableColumn<ComponentObject, Hyperlink>("Template Id");
template_id.setCellValueFactory(
new PropertyValueFactory<ComponentObject, Hyperlink>("template"));
template_id.setCellFactory(TextFieldTableCell.forTableColumn());
template_id.setOnEditCommit(
new EventHandler<CellEditEvent<ComponentObject, Hyperlink>>() {
@Override
public void handle(CellEditEvent<ComponentObject, Hyperlink> t) {
((ComponentObject) t.getTableView().getItems().get(
t.getTablePosition().getRow())
).setTemplate((javafx.scene.control.Hyperlink) t.getNewValue());
}
}
);
这里 setCellFactory 给出的错误是 "
The method setCellFactory(Callback<TableColumn<ComponentObject,Hyperlink>,TableCell<ComponentObject,Hyperlink>>) in
the type TableColumn<ComponentObject,Hyperlink> is not applicable for the arguments
(Callback<TableColumn<Object,String>,TableCell<Object,String>>)
"
如何解决这个问题?我想让 template_id 列可编辑..但请注意它是超链接..
【问题讨论】:
标签: javafx hyperlink tableview tablecolumn