如何将动作侦听器添加到议程中的约会(JFXtras议程) [英] How can I add an action Listener onto an appointment in an agenda (JFXtras Agenda)

查看:140
本文介绍了如何将动作侦听器添加到议程中的约会(JFXtras议程)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

推荐答案

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

这篇关于如何将动作侦听器添加到议程中的约会(JFXtras议程)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆