With the JXDayPicker it is hard to change a year, as the user has to click 12 times to achieve this. Therefor I have the same problem as Java Swing JXDatePicker.
The problem is that I want to stick with SwingX and that I need a solution which only changes one JXDatePicker.
Thus the proposed solution:
UIManager.put(CalendarHeaderHandler.uiControllerID, SpinningCalendarHeaderHandler.class.getName());
datePicker = new JXDatePicker();
datePicker.getMonthView().setZoomable(true); //this is needed for custom header
does not work for me. I also took a look at the MonthViewExtDemo class of the Swinglabs Demo, but I have not figured out what is going on.
Initially I thought it would be as simple as:
JXDatePicker picker = new JXDatePicker();
JXMonthView monthView = picker.getMonthView();
monthView.setZoomable(true);
SpinningCalendarHeaderHandler handler = new SpinningCalendarHeaderHandler();
handler.install(monthView);
But apparently I was wrong.
Update: The requirements were changed a bit, such that every JXDatepicker could use the SpinningCalendarHeaderHandler, but does not have to. Therefor the proposed solution (above) can be used. I use the following in the beginning of the application:
UIManager.put(
CalendarHeaderHandler.uiControllerID,
"org.jdesktop.swingx.plaf.basic.SpinningCalendarHeaderHandler");
UIManager.put(
SpinningCalendarHeaderHandler.ARROWS_SURROUND_MONTH,
Boolean.TRUE);
And, later on, for the specific datePicker, which should use the SpinningCalendarHeaderHandler, I use:
datePicker.getMonthView().setZoomable(true);
This works for the moment, as the zoomable functionality is not implemented yet. But yeah, I think you can call this a hack.