Ejemplo n.º 1
0
 public void setCalendar(Calendar cal) {
   // this.cal = cal;
   dayField.setText(Integer.toString(cal.get(Calendar.DAY_OF_MONTH)));
   monthField.setText(Integer.toString(cal.get(Calendar.MONTH) + 1));
   yearField.setText(Integer.toString(cal.get(Calendar.YEAR)));
   model.setSelection(cal);
 }
Ejemplo n.º 2
0
  private void updateCalendar() {
    Calendar cal = model.getSelection();
    if (!"".equals(dayField.getText())) {
      cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dayField.getText()));
    }

    if (!"".equals(monthField.getText())) {
      // Calendar month starts at 0
      cal.set(Calendar.MONTH, Integer.parseInt(monthField.getText()) - 1);
    }

    if (!"".equals(yearField.getText())) {
      cal.set(Calendar.YEAR, Integer.parseInt(yearField.getText()));
    }
    model.setSelection(cal);
  }