开发者

Swing time picker

Im looking for a pretty and decent time picker component. There are a lot of alternatives for date picking on Swing but no for time.

I've seen nice Date/Time components picking on JQuery ( for example: http://trentrichardson.com/examples/timepicker/ ). There is something similar on Swing?

Thanks i开发者_运维知识库n advance.


Use JSpinner with SpinnerNumberModel


I would suggest the TimePicker component of the LGoodDatePicker library. The time can be chosen with the (default) "drop down" menu, with (optional) "spinner" style buttons, or both.

Fair disclosure: I'm the primary developer.

The TimePicker can be customized with optional settings. A few of the settings are the language (locale), default times in the drop down menu, fonts and colors, display/menu/parsing formats, 12 or 24 hour clock, seconds or nanoseconds precision, and so forth.

The library also includes the DatePicker and DateTimePicker components. All three components are easy to use. (They can each be instantiated with a single line of code.)

I've pasted screenshots of the components and the demo application below.

Project Home page: https://github.com/LGoodDatePicker/LGoodDatePicker .

Swing time picker

( Click to enlarge the demo screenshot. )

Swing time picker


I think you will like the ease of JCalendar. It offers a JDateChooser, a JDayChooser or a JSpinnField, written by Kai Toedter', available here: JCalendar 1.4.

Swing time picker

You can get your dates like this:

java.util.Date fromDate = jDateChooser1.getDate();

JSpinnField lets you set max and min values easily:

jSpinField1.setMaximum(59);
jSpinField1.setMinimum(0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜