title: How to use SpinnerDateModel
body: <p>This is my code for <code>Datespinner</code></p>
  
  <pre><code>//DateOfBirth{
      DateOfBirth = new JLabel("Date Of Birth (MM/DD/YYYY): ");
      DateOfBirth.setBounds(50,490,180,20);
      jpanel.add(DateOfBirth);
  
      Date date1 = new Date();
      dobmodel = new SpinnerDateModel(date1,null,null,Calendar.YEAR);
      dobspinner = new JSpinner(dobmodel);
      JSpinner.DateEditor ded = new JSpinner.DateEditor(dobspinner,"MM/dd/yyyy");
      dobspinner.setEditor(ded);
      dobspinner.setBounds(250, 490, 125, 20);
      jpanel.add(dobspinner);
  
      //I used a ChangeListener
  
  
      dobspinner.addChangeListener(new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e1) {
             int DateOfBirth1 = (int) ((JSpinner) e1.getSource()).getValue();
          }
  
          public void stateChanged1(ChangeEvent arg01) {
  
          }
      });
  </code></pre>
  
  <p>But I am getting the following error:  </p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.util.Date cannot be cast to
    java.lang.Integer.</p>
  </blockquote>
  
  <p>What should i do? I am stuck.</p>