0

I am getting an error that it can't find the method getModel() and I am not sure what to do about this. I am trying to make it so that when a button is clicked, the dob variable is set to the value in the jdatechooser.

public Calendar getDOB()
{
return dob;
}    


JDateChooser jdc = new JDateChooser();
JCalendar jc = new JCalendar();

Calendar calendar;

UtilDateModel model = new UtilDateModel();
 model.setDate(1990, 8, 24);
 JDatePanelImpl datePanel;
 JDatePickerImpl datePicker;

Person samplePerson = new Person();

btnSubmit.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent e)
        {
            samplePerson.setDOB(calendar.getModel().getValue());
        }
    });
Jonathan Math
  • 101
  • 2
  • 7

2 Answers2

0

You're calling the getModel method on your Calendar instance (which doesn't have a getModel method) instead of on your JDatePanel instance

Zach
  • 315
  • 6
  • 15
  • JDateChooser also has no getModel method. See the [javadoc](http://javadox.com/com.toedter/jcalendar/1.4/doc/api/com/toedter/calendar/JDateChooser.html) – Jens Mar 23 '17 at 13:43
  • Good call @Jens I didn't check the api for JDateChooser. – Zach Mar 23 '17 at 13:45
0

nevermind! I got it! The following line worked for me.

samplePerson.setDOB(jdc.getCalendar());
Jonathan Math
  • 101
  • 2
  • 7