get a value from JDateChooser and show it back on same JDateChooser

2.2k views Asked by At

I want to show a value from from database and put it back on the same JDateChooser as input before, I already changed the JDateChooser event property changed:

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()));
    }
}

Do the save button in this way:

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

And when I'm going to show it in the table it works somehow, but when I click on the data it should be fill the same field before, I do this:

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

It didn't work and JDateChooser didn't show any value from table, except other field, I know that I must converting String into Date before, but I didn't know how to, or anybody has another way?

0

There are 0 answers