4

I am looking for a component for Swing that would do the same thing that Windows 7 date and time pickers do (or be even better). They look so:

Windows 7 example

And have following features I need:

  • you cannot enter an invalid value (value is ignored as you type and not when you leave the field)
  • it allows continuous updating of the field until the first change made by user (take a look on the time setting in Windows 7)
  • you can select and change at once only one position - not the whole text at once (so colons and points cannot be removed)
  • up and down buttons
  • calendar button (but it's rather optional for me)

I have tried JSpinner with a DateEditor but it doesn't have this features. JXDatePicker only adds the calendar button.

Generally I am looking for a nice way to let user enter date and time in a powerful and simple way. Windows 7 solution seems to be quite good.

Thank you!

Community
  • 1
  • 1
Andrej
  • 1,679
  • 1
  • 26
  • 40
  • possible duplicate of [What are good Java date-chooser Swing GUI widgets?](http://stackoverflow.com/questions/1339354/what-are-good-java-date-chooser-swing-gui-widgets) – Qwerky Jan 30 '12 at 12:29
  • 1
    @Qwerky That question is about date pickers only. And there was only one requirement - nice look. I am asking about both - time and date. – Andrej Jan 30 '12 at 13:49
  • 1
    @mKorbel Why did you remove the tag "timepicker"? I am interested not only in date pickers. – Andrej Jan 30 '12 at 14:10
  • @Andrej yu can revert that, but date & time are implemented in Date or Calendar API or Custom Java Calendar or DatePicker by default returns datum or time or both, depends of your setting in your code – mKorbel Jan 30 '12 at 14:26

1 Answers1

3

best and free DatePickers around are JXDatePicker and JCalendar, in both cases are there focus about correct implementations of Date and Focus workaround, and excelent Renderer and Editor for JTree / JTreeTable / JTable

to your needs ---> all these funcionalities are implemented by default, not clear from your questions exactly whats wrong, I'm Win7 and JXDatePicker and JCalendar but I never saw these issues,

in both cases you have to implementing own workaround for SpecialDays as hollydays (and etc),

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • Thanks, but I didn't see any up-down buttons in JXDatePicker... It also doesn't restrict user selection and you can select the whole content of the component and put crap there... – Andrej Jan 30 '12 at 13:44
  • 1
    JCalendar is only about date. It cannot be used for time input. – Andrej Jan 30 '12 at 13:52
  • please both API are fully configurable including Date / Time Format, download code_source and required customizations is/are up, about your knowledges from Java essential classes, minor from Swing – mKorbel Jan 30 '12 at 13:59
  • 1
    Sorry, but I don't get your sentence. – Andrej Jan 30 '12 at 14:06
  • @Andrej there aren't same Calendar like as you can see in Win7, there are free JavaCalendar, where you have to code the rest of whatever you missed there or there are Custom Calendar against payment and rest will be encoded against youor payment too – mKorbel Jan 30 '12 at 14:10