我在jfxtras库中使用JavaFx。我将"Agenda“控件包含到我的fxml中,并且它被正确地呈现在页面上。遗憾的是,表中没有显示关联的约会,也没有关联的事件。如何实现样例的相同行为?我在哪里可以找到关于这个控件的教程?下面是java代码:
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);发布于 2015-07-28 13:50:15
是的,不需要教程,每个人都会偶尔犯这个错误;您正在使用LocalDate提供的月份来创建日历。然而,LocalDate的月份是从1到12,Calendar是从0到11,所以约会实际上是在今天之后的一个月。
我建议您开始使用Java8 Date API。
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);https://stackoverflow.com/questions/31664111
复制相似问题