JCalendar多天选择 [英] JCalendar multiple day selection
问题描述
是否可以在toedter的JCalendar中选择多天?就像我可以在日历中突出显示2或3天,然后在我使用按钮触发事件后突出显示日期。
Is it possible to select multiple days in toedter's JCalendar? Like I would be able to highlight 2 or 3 days in the calendar and then get the days highlighted after I would trigger an event using a button.
或者我应该更好使用JTable作为日历?
or should i be better off using a JTable for a calendar?
推荐答案
我使用一列 JTable
拥有 JDateChooserCellEditor
和自定义渲染器。 DemoTable
就是一个例子,见此处。 TableModel
应包含 List< java.util.Date>
, Date
implements Comparable
for easy 排序。您可以在 DemoTableModel
中提供 addRow()
方法,可以在 Add 按钮的处理程序。
I'd use a one column JTable
having a JDateChooserCellEditor
and a custom renderer. DemoTable
is an example, seen here. The TableModel
should contain a List<java.util.Date>
, as Date
implements Comparable
for easy sorting. You can supply an addRow()
method in DemoTableModel
, which can be invoked in your Add button's handler.
这篇关于JCalendar多天选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!