How can I add an action Listener onto an appointment in an agenda (JFXtras Agenda)

后端 未结 2 1912
天涯浪人
天涯浪人 2021-01-17 03:26

How can I add an action Listener so that when an appointment on an agenda is clicked a new window with more details on that particular clicked appointment opens.

2条回答
  •  被撕碎了的回忆
    2021-01-17 03:39

    lAgenda.selectedAppointments().addListener(new ListChangeListener< Appointment >() {
         public void onChanged(Change c) {
             while (c.next()) {
                 if (c.wasPermutated()) {
                     for (int i = c.getFrom(); i < c.getTo(); ++i) {
                          //permutate
                     }
                 } else if (c.wasUpdated()) {
                          //update item
                 } else {
                     for (Appointment a : c.getRemoved()) {
                     }
                     for (Appointment a : c.getAddedSubList()) {
                         printAppointment(a);
                     }
                 }
             }
         }
     });
    

    Then print appointments:

    private void printAppointment(Appointment a) {
        System.out.println(a.getSummary());
        System.out.println(a.getDescription());
    }
    

提交回复
热议问题