Home Forums CalendarFX How to set the color for entry in YearMonth view

  • Author
    Posts
  • NHS
    Participant
    Post count: 26
    #13096 |

    It seems that the YearMonthview always use yellow to indicate if a day has an entry. Should it use Style like?

    Calendar workingHours = new Calendar(“Working hours”);
    workingHours.setStyle(Calendar.Style.STYLE7);

    How can the color be set ?

  • Dirk Lemmermann
    Keymaster
    Post count: 61
    #13104 |

    The “usage” colors are defined inside calendar.css. If you want to use your own color concept then please start looking into supplying your own cell factory.

  • NHS
    Participant
    Post count: 26
    #13105 |

    Can you give a tip on how to bind style for each day to any entry on the day having own cell factory

    yearMonthView.setCellFactory(new Callback<LocalDate, Node>() {
    @Override
    public Node call(LocalDate param) {
    int dayOfMonth = param.getDayOfMonth();
    Label label = new Label(Integer.toString(dayOfMonth));

    // bind?
    return label;
    }
    });

  • NHS
    Participant
    Post count: 26
    #13106 |

    I solved this by implementing a custom skin

You must be logged in to reply to this topic.