6

有谁知道是否可以使用 swingx 的 jxdatepicker 选择多天?我正在使用 swingx 1.6.1 版(看起来是最新的)。

4

1 回答 1

3

看起来 JXMonthView 类中有不推荐使用的方法......所以我能够通过使用 JXMonthView 类的 getSelection 方法让它返回所有选定的日期。

例如....

JXDatePicker picker = new JXDatePicker(System.currentTimeMillis());
         final JXMonthView monthView = picker.getMonthView();
         monthView.setSelectionMode(JXMonthView.SelectionMode.SINGLE_INTERVAL_SELECTION);
         monthView.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                System.out.println((monthView.getSelection()));
            }
         });
于 2010-09-02T18:43:02.810 回答