How many times did you need a date picker widget? you know, like the one from the GWT for example, and there are many others available.
Unfortunatelly the Java Swing library doesn't have a built-in one. Anyways, I found a good starting point here, http://sourceforge.net/projects/datepicker/ -- which is a very nicely done example, a little incomplete, but still good to go.
Because I wanted this widget to be perfect, I've updated and enhanced and it can do the followings:
- automatic extract the name of the days and months from the Java locale (not like the original from a properties file).
- automatic detects and display the first day of the week according with the used locale (not like the original that uses hard-coded only US style).
- correct the coloring in red of the weekend days (not like original that had only Sundays on red, and Saturdays on gray).
- corrected the button images to have all the same size (better header than the original)
- implemented the "close on away click" feature to easily close the picker dialog when click away.
The first image is a read-only text-field and a button, which will open the date-picker dialog, as seen in the second image.
We can fast scroll though months and years, or quickly select from the 2 combos, and for the days just press on the date, which you want to select.
Hope you like it -- the source code is available here.
PS: you can see this widget at work, in my free application Money On Thread.