I'm using SwingX JXDatePicker and I can't figure out how to provide next/previous year buttons (as by default it only provides next/previous month buttons).
Also, it seems that SwingX is not maintained anymore: should I be using a more recent component as date picker?
Any help/hint would be greatly appreciated. Thanks, Thomas
UPDATE:
To clarify the question, I added a JXDatePicker screenshot and highlighted in red the next/previous month buttons. The questions is thus: how to add buttons that will bring the calendar to next/previous year? Please note that the new buttons need to be standard components as they need to be rendered by a particular Look & Feel manager (Insusbtantial in this case).
Many thanks
I know this is an old question, but I finally found the answer here, from kleopatra's comment about SwingsLab demo.
The SwingsLab demo provides an example of how to set a custom calendar header on a per-component basis, but this is the code I actually used (this is global; per-application):
UIManager.put(CalendarHeaderHandler.uiControllerID, SpinningCalendarHeaderHandler.class.getName());
datePicker = new JXDatePicker();
datePicker.getMonthView().setZoomable(true); //this is needed for custom header
This seems to be experimental code (not fully public yet), so use at own risk. Hope it helps.
I would recommend using Microba DatePicker. It's highly customizable and does exactly what you want.
http://microba.sourceforge.net/
Edit:
Ok I see. Well I did some research and it seems the function you are looking for is actually not present in JXDatePicker.
A different alternative I found is: JDatePicker at http://sourceforge.net/projects/jdatepicker/.
Main website: https://jdatepicker.org/
This is still supported and seems to have the function you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With