问题
I need some help to be able to set the first day of week from Sunday to Monday (change SMTWTFS to MTWTFSS) in com.toedter.calendar.JDateChooser
, I tried like this with no result, I'm using version 1.3.3 of JDateChooser:
JDateChooser dateChooser = new JDateChooser(new Date());
dateChooser.getCalendar().setFirstDayOfWeek(Calendar.MONDAY);
回答1:
Following the conventions of proper getter implementation, getCalendar() probably returns a copy of the calendar used. Therefore your call to setFirstDayOfWeek() is on an object that is not the calendar object of your JDateChooser.
I can't seem to find the documentation for JDateChooser 1.3.3, but if setCalendar() exists, this should work:
Calendar c = dateChooser.getCalendar();
c.setFirstDayOfWeek(Calendar.MONDAY);
dateChooser.setCalendar(c);
来源:https://stackoverflow.com/questions/19095185/set-first-day-of-week-in-jdatechooser