JavaFx日历选择器Api JFXTras

时间:2016-03-17 07:29:09

标签: javafx-8

在这里,我使用JFXtras API创建了日历选择器,在这里,我从Spring rest Web服务获取事件,并使用突出显示可观察列表突出显示日历日期。

但是在这里,我的要求是突出显示的日期,如果我们点击然后我们必须在该日期显示事件,为此我想从日历选择器获取日期,但我想用什么监听器来获取选定的日期。

    CalendarPicker calendarPicker = interfaceHandler.getCalendarPicker();
    calendarPicker.setMode(Mode.MULTIPLE);

    ObservableList<Calendar> calendars = calendarPicker
            .highlightedCalendars();

    if (listOfEvents != null && listOfEvents.size() > 0) {
        for (Events events : listOfEvents) {

            SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
                    "MM/dd/yyyy");

            Date date = events.getEventDate();
            System.out.println("+"
                    + simpleDateFormat.format(events.getEventDate()));

            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            int year = cal.get(Calendar.YEAR);
            int month = cal.get(Calendar.MONTH);
            int day = cal.get(Calendar.DAY_OF_MONTH);

            System.out.println("+=year" + year);

            Calendar gc = new GregorianCalendar(year, month, day);

            simpleDateFormat.setCalendar(gc);
            calendars.add(gc);
            System.out.println("The Size=" + calendars.size());

            // DatePicker
        }

    }
    //calendarPicker
    // calendarPicker.setCalendarRangeCallback(value,calendar);
    System.out.println("+=" + calendars);

    System.out.println(calendarPicker.displayedCalendar());
    CalendarPickerControlSkin calendarPickerControlSkin = new CalendarPickerControlSkin(
            calendarPicker);
    calendarPickerControlSkin.setShowWeeknumbers(ShowWeeknumbers.NO);
    calendarPicker.setSkin(calendarPickerControlSkin);

0 个答案:

没有答案