0

I'm trying to paint a set of specific dates on a JCalendar from toedter using IDateEvaluator but... after adding the DateEvaluator to the DayChooser nothing happens. On a post here I noticed that I needed to set my JCalendar calendar to itself so it can update... but since I have some PropertyChangeListeners on the monthChooser and YearChooser and this are the listeners that call the coloring function I cannot set it to itself because it just keeps activating them in a loop. Heres my code:

    monthChooser.addPropertyChangeListener("month", new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent e) {
                if(e.getPropertyName().equals("month")){
                    JCalendar calendarAux = setNewMonth(monthChooser.getMonth(), yearChooser.getYear());
                    calendar.setCalendar(calendarAux.getCalendar());
                }
            }
        });

    yearChooser.addPropertyChangeListener("year", new PropertyChangeListener(){
            @Override
            public void propertyChange(PropertyChangeEvent e){
                if(e.getPropertyName().equals("year")){
                    JCalendar calendarAux = setNewMonth(monthChooser.getMonth(), yearChooser.getYear());
                    calendar.setCalendar(calendarAux.getCalendar());
                }
            }
        });

    public JCalendar setNewMonth(int month, int year){
    monthDate = calendarSearch.getMonth(month, year);
    List<Date> datesList = getDates();
    System.out.println("Hello, im here");
    if(!datesList.isEmpty()){
        for(Date date : datesList){
        System.out.println(date + "Hello, im here too!");
        }
        HighlightEvaluator highlightEvaluator = new HighlightEvaluator(datesList);
        calendar.getDayChooser().addDateEvaluator(highlightEvaluator);
        lblNewLabel_1.setText(calendarSearch.getTotalMonthDistance(month, year));
    }
    return calendar;
}

The HighlightEvaluator implements IDateEvaluator is only the List(Date) and the isSpecial function is true if it is in the list. The rest of the functions are the colors when it is special. Hope someone can help me!

0 Answers0