I'm using JCalendar
and have setup a listener using a PropertyChangeListener
. My problem is that this listener will not respond to an event on the current day, I assume because there is no change in the property. I want it to be able to respond to selecting today's date, as the calendar leads to a diary. When opened I still want the calendar to open on "today's" date, but to have a listener that will respond to pressing "today's" date. My code for the listener is below:
final JCalendar calendar = new JCalendar();
calendar.getDayChooser().addPropertyChangeListener("day", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if(Calendar.AddJob!=1){
JOptionPane.showMessageDialog(null,"No Entry Found");
frame.dispose();
String date = EditDate(calendar.getDate().toString());
WorkDiary.WorkDiaryGui(date);
}
if(Calendar.AddJob==1){
String date = EditDate(calendar.getDate().toString());
Calendar.AddJob=0;
frame.dispose();
WorkDiaryAddJob.WorkDiaryAddJobGui(CalReg, date);
}
}
});