如何双击以编辑日期,例如电子邮件。请帮我! 我刚学了1周
TableColumn<datadetail, String> id =
new TableColumn<datadetail, String>("Id");
TableColumn<datadetail, String> email =
new TableColumn<datadetail, String>("Email");
TableColumn<datadetail, Date> datum =
new TableColumn<datadetail, Date>("Datum");
email.setCellValueFactory(new PropertyValueFactory<>("email"));
email.setCellFactory(TextFieldTableCell.<datadetail> forTableColumn());
email.setOnEditCommit((CellEditEvent<datadetail, String> event) -> {
TablePosition<datadetail, String> pos = event.getTablePosition();
String newEmail = event.getNewValue();
int row = pos.getRow();
datadetail datadetail = event.getTableView().getItems().get(row);
datadetail.setEmail(newEmail);
});