Code consists of just month and year can be chosen in jcalendar, by default the day is 30 and 28 for February, the issue comes when I choose February, automatically jcalendar sets to March 30; this is the code; it is in PropertyChange
event of jcalendar.
Calendar cal = PFI.getCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
if(month==1){
cal.set(year, 1 , 28);
PFI.setCalendar(cal);
}
else
{
cal.set(year, month , 30);
PFI.setCalendar(cal);
}
Combining the suggestions of @Ole V.V. and @Catalina Island, the fragment below illustrates
JYearChooser
andJMonthChooser
in aGridLayout
. A common listener then usesjava.time
to display the last day of the selected year and month.