/** @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) */ public void stateChanged(ChangeEvent evt) { JTimeField outer = JTimeField.this; CalendarModel model = outer._support.getModel(); outer._hourField.setText(String.valueOf(model.get(Calendar.HOUR_OF_DAY))); outer._minuteField.setText(this._df.format(model.get(Calendar.MINUTE))); outer._secondField.setText(this._df.format(model.get(Calendar.SECOND))); repaint(); }
/** The method that saves the calendar to the file. */ public void save() throws IOException { if (file == null) throw new NullPointerException("file"); ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file)); out.writeObject(cm.getDefaultApptTmpl()); out.writeInt(cm.getAppointmentTemplateSet().size()); for (AppointmentTemplate apptTmpl : cm.getAppointmentTemplateSet()) out.writeObject(apptTmpl); out.writeInt(cm.getApptSet().size()); for (RefAppointment appt : cm.getApptSet()) { out.writeObject(appt); } }
void refreshView() { adapter = new ArrayAdapter<CalendarInfo>( this, android.R.layout.simple_list_item_1, model.toSortedArray()) { @Override public View getView(int position, View convertView, ViewGroup parent) { // by default it uses toString; override to use summary instead TextView view = (TextView) super.getView(position, convertView, parent); CalendarInfo calendarInfo = getItem(position); view.setText(calendarInfo.summary); return view; } }; listView.setAdapter(adapter); }