0

Does anyone know of any good Java bean (a graphic widget) or use of Swing, that allows a user to choose a time? They only need to select the hour and minute they want, not the second or millisecond etc.

I have found a good date selection bean (JCalendar), but I am in desperate need of one that allows the user to easily select the time.

This could be done by clicking on some kind of clock or graphical element (I don't want the user to manually enter the time because the minutes must go up in fives (e.g. 10:00 or 10:05 or 10:10 etc.)

I have tried using a JSpinner, but this doesn't work because I am not entirely sure how to format it properly so that the user doesn't enter the wrong time (the minutes must go up in 5's, etc.).

At the moment I am using 2 combo box's, one for the hour (from 00 to 23) and one for the minute (from 00 to 55) but I find this annoying to use sometimes, due to misclicking, and it is not very visually attractive or easy to understand.

An example of what I am using

Can anyone suggest a Java bean that fulfills this need?

Oliver Funk
  • 166
  • 1
  • 15
  • Uh, "Java bean" is confusing here :) You probably mean a (graphic) widget? – fge Jun 24 '13 at 11:03
  • thank you, I've made the change – Oliver Funk Jun 24 '13 at 11:07
  • possible duplicate of [Setting Time Format for jspinner in swings](http://stackoverflow.com/questions/3845374/setting-time-format-for-jspinner-in-swings) – trashgod Jun 24 '13 at 11:31
  • @trashgod I have already tried using a JSpinner, but it may result in the user entering a time value that is not valid (i.e. the minutes may not be in multiples of 5). Is there a way to disallow the user entering a value? Also is there a way to make the minutes section of the Spinner go up in 5's? If so, I could use a JSpinner. – Oliver Funk Jun 24 '13 at 12:10
  • I guess you can always resort to two separate spinners, withe one model listening to the other; see also this [answer](http://stackoverflow.com/a/2902275/230513). – trashgod Jun 24 '13 at 12:44

0 Answers0