1

I am using JDateChooser with JCalendar in application. User should choose the date in date chooser and date should be updated in JTextFieldDateEditor. However, I can't seem to get the PropertyChangeListener to work.

I have checked it on stackoverflow as well, found Is it possible to detect a date change on a JCalendar JDateChooser field? which seems to be the exact same problem as I am having. I copied the code through from there, but I still get 'cannot find symbol - class PropertyChangeListener' error. I imported whole awt.event and JCalendar libraries. I am absolutely clueless as to what is wrong with my code.

Here's what I have written so far

datum = new Date ();
klik = new JDateChooser (datum)

klik.getDateEditor().addPropertyChangeListener( new PropertyChangeListener() 
{
    @Override
    public void propertyChange(PropertyChangeEvent e) 
    {
        if ("date".equals(e.getPropertyName())) 
        {
            System.out.println(e.getPropertyName()
                + ": " + (Date) e.getNewValue());
        }
    }
});

which is basically copy-paste from the link above, but it seems reasonable to me

Thanks for your help :)

Community
  • 1
  • 1

0 Answers0