How can I add an action Listener onto an appointme

2019-02-21 02:35发布

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条回答
萌系小妹纸
2楼-- · 2019-02-21 02:58

It seems like Agenda has not api for that. You can see agenda's sources: AbstractAppointmentPane has mouse event logic.

查看更多
我想做一个坏孩纸
3楼-- · 2019-02-21 03:09
lAgenda.selectedAppointments().addListener(new ListChangeListener< Appointment >() {
     public void onChanged(Change<? extends Appointment> 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());
}
查看更多
登录 后发表回答