Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
对于时间选择器,您可以使用 JSpinner 并设置仅显示时间值的 JSpinner.DateEditor。
For a time picker you can use a JSpinner and set a JSpinner.DateEditor that only shows the time value.
您可以扩展 swingx JXDatePicker 组件:
http://wiki.java.net/twiki/bin/view/Javadesktop/JXDateTimePicker
编辑:这篇文章从网络上消失了,但正如 SingleShot 发现的那样,它仍然可以在互联网档案中找到。 可以肯定的是,这是完整的工作示例:
You can extend the swingx JXDatePicker component:
http://wiki.java.net/twiki/bin/view/Javadesktop/JXDateTimePicker
EDIT: This article disappeared from the web, but as SingleShot discovered, it is still available in an internet archive. Just to be sure, here is the full working example:
结合使用两者..这就是我所做的:
Use the both combined.. that's what i did:
有一个带有组合日期和时间选择器的 FLib-JCalendar 组件。
There is the FLib-JCalendar component with a combined Date and Time Picker.
正如您所说,日期选择器很简单,有很多。
至于时间选择器,请查看 Google 日历在创建新条目时如何执行此操作。 它允许您输入任何内容,同时它会以 30 分钟为增量进行下拉。 当您更改分钟时,下拉列表会发生变化。
如果您需要允许用户选择秒,那么您能做的最好的就是可输入/下拉组合
As you said Date picker is easy, there are many out there.
As for a Time picker, check out how Google Calendar does it when creating a new entry. It allows you to type in anything while at the same time it has a drop down in 30 mins increments. The drop down changes when you change the minutes.
If you need to allow the user to pick seconds, then the best you can do is a typable/drop down combo