如何将动作侦听器添加到议程中的约会(JFXtras议程)

时间:2014-03-27 08:18:48

标签: java javafx appointment jfxtras

如何添加动作侦听器,以便在单击议程上的约会时,将打开一个新窗口,其中包含有关该特定单击约会的更多详细信息。

2 个答案:

答案 0 :(得分:1)

似乎议程没有api。您可以看到议程的来源:AbstractAppointmentPane具有鼠标事件逻辑。

答案 1 :(得分:1)

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);
                 }
             }
         }
     }
 });

然后打印约会:

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