首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >议程jfxtras的问题

议程jfxtras的问题
EN

Stack Overflow用户
提问于 2015-07-28 06:04:01
回答 1查看 694关注 0票数 0

我在jfxtras库中使用JavaFx。我将"Agenda“控件包含到我的fxml中,并且它被正确地呈现在页面上。遗憾的是,表中没有显示关联的约会,也没有关联的事件。如何实现样例的相同行为?我在哪里可以找到关于这个控件的教程?下面是java代码:

代码语言:javascript
复制
   LocalDate lTodayLocalDate = LocalDate.now();
   Agenda.Appointment[] lTestAppointments = new Agenda.Appointment[]{
       new Agenda.AppointmentImpl()
           .withStartTime(new GregorianCalendar(lTodayLocalDate.getYear(), lTodayLocalDate.getMonthValue(), lTodayLocalDate.getDayOfMonth(), 4, 00))
           .withEndTime(new GregorianCalendar(lTodayLocalDate.getYear(), lTodayLocalDate.getMonthValue(), lTodayLocalDate.getDayOfMonth(), 5, 30))
           .withSummary("A")
           .withDescription("A much longer test description")
           .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
   };
   agenda.appointments().addAll(lTestAppointments);
EN

回答 1

Stack Overflow用户

发布于 2015-07-28 13:50:15

是的,不需要教程,每个人都会偶尔犯这个错误;您正在使用LocalDate提供的月份来创建日历。然而,LocalDate的月份是从1到12,Calendar是从0到11,所以约会实际上是在今天之后的一个月。

我建议您开始使用Java8 Date API。

代码语言:javascript
复制
       LocalDate lTodayLocalDate = LocalDate.now();
       Agenda.Appointment[] lTestAppointments = new Agenda.Appointment[]{
           new Agenda.AppointmentImplLocal()
               .withStartLocalDateTime(lTodayLocalDate.atTime(4, 00))
               .withEndLocalDateTime(lTodayLocalDate.atTime(5, 30))
               .withSummary("A")
               .withDescription("A much longer test description")
               .withAppointmentGroup(lAppointmentGroupMap.get("group07"))
       };
       ctrl.appointments().addAll(lTestAppointments);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31664111

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档