在行javafx中编辑日期

时间:2019-04-27 19:05:18

标签: java javafx

如何双击以编辑日期,例如电子邮件。请帮我! 我刚学了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);
     });

0 个答案:

没有答案