I am using the DateComboBox.
I am trying to register a listener when the date change so I can get the new date the user just selected.
It doesn't seems to work.
Here a code snippet I use :
- Code: Select all
DateModel dateModel;
DateComboBox dateCB = new DateComboBox();
dateCB.setCalendar(Calendar.getInstance());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateCB.setFormat(dateFormat);
dateModel = dateCB.getDateModel();
dateModel.addDateModelListener( new DateModelListener() {
@Override
public void dateModelChanged(DateModelEvent arg0) {
Date date = dateCB.getDate();
System.out.println(" New date = " + date.toString());
}
});
When I change the date in the combo box, it dosent print the "new date " .
Did I miss something ?
Thanks for your help !