0

我想从数据库中显示一个值并将其放回与JDateChooser之前输入相同的位置,我已经更改了JDateChooser事件属性已更改:

private void txtBirthPropertyChange(java.beans.PropertyChangeEvent evt) {
    if(txtBirth.getDate()!=null){
        SimpleDateFormat Format = new SimpleDateFormat("dd/mm/yyyy");
        date1=String.valueOf(Format.format(txtBirth.getDate()));
    }
}

以这种方式执行保存按钮:

        employee emp = new employee();
        emp.setNoid(txtNoid.getText());
        emp.setName(txtNama.getText());
        emp.setPlace(txtPlace.getText());
        emp.setBirth(date1);

当我要在表格中显示它时,它会以某种方式工作,但是当我点击数据时,它应该之前填写相同的字段,我这样做:

    employee emp=record.get(row);
    txtNoid.setText(pgw.getNoid());
    txtName.setText(pgw.getName());
    txtPlace.setText(pgw.getPlace());
    txtBirth.setDate(pgw.getBirth());

它不起作用,JDateChooser也没有显示表中的任何值,除了其他字段,我知道我必须先转换StringDate但我不知道如何,或者有人有其他方法吗?

4

0 回答 0