【问题标题】:add date & time with calendar [closed]用日历添加日期和时间[关闭]
【发布时间】:2014-09-11 03:31:38
【问题描述】:

我需要从用户那里得到日期和时间。 我希望它会打开一个日历,并且用户将选择日期和时间(就像在 Microsoft Office 中一样)。

这可能吗?你是怎么做到的?

示例:

image http://s1.postimg.org/oq6vtfv63/pic.jpg

【问题讨论】:

  • 您可能需要在 Google 上搜索“java 日期时间选择器”之类的内容。当您尝试创建/使用其中之一时,您会遇到一些代码问题,然后回来询问这些问题。现在看起来你是在要求我们为你写它,或者建议一个工具/库。这两个请求在这里都是题外话。
  • 谢谢! @Pshemo。时间呢?可能的?不,我不知道“java 日期选择器”。非常感谢,对此我深表歉意。
  • 是的,有可能。无论如何检查我的updated comment
  • 也许这会让你感兴趣stackoverflow.com/questions/654342/…
  • 非常非常感谢!你帮了我很多! @Pshemo

标签: java date datetime time calendar


【解决方案1】:

您可以使用来自http://jdatepicker.org/ 的 JDatePicker。

看起来像

有一些代码sn-ps How to use JDatePicker to display calendar component,例如创建上图所示的picker:

UtilDateModel model = new UtilDateModel();
JDatePanelImpl datePanel = new JDatePanelImpl(model);
JDatePickerImpl datePicker = new JDatePickerImpl(datePanel);

frame.add(datePicker);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多