0

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • Please, please follow java conventions about capitalizing class names (type names) and writing method names with first small letter. Every tutorial for beginners explains this for sake of better readability. – Meno Hochschild Jan 01 '14 at 18:50
  • Second: You have not shown how you come from Employee-variable emp to here unspecified variable pgw. I can only speculate. Maybe you wanted txtBirth.setDate(emp.getBirth()); ??? Please show more relevant code. – Meno Hochschild Jan 01 '14 at 18:52

0 Answers0