コード例 #1
0
  /**
   * Sets the date. Fires the property change "date".
   *
   * @param date the new date.
   */
  public void setDate(Date date) {
    Date oldDate = calendar.getTime();
    calendar.setTime(date);

    yearChooser.setYear(calendar.get(Calendar.YEAR));
    monthChooser.setMonth(calendar.get(Calendar.MONTH));
    dayChooser.setDay(calendar.get(Calendar.DATE));

    firePropertyChange("date", oldDate, date);
  }
コード例 #2
0
  /**
   * Sets the calendar attribute of the JCalendar object
   *
   * @param c the new calendar value
   * @param update the new calendar value
   */
  private void setCalendar(Calendar c, boolean update) {
    Calendar oldCalendar = calendar;
    calendar = c;

    if (update) {
      // Thanks to Jeff Ulmer for correcting a bug in the sequence :)
      yearChooser.setYear(c.get(Calendar.YEAR));
      monthChooser.setMonth(c.get(Calendar.MONTH));
      dayChooser.setDay(c.get(Calendar.DATE));
    }

    firePropertyChange("calendar", oldCalendar, calendar);
  }