我正在使用JavaFx和jfxtras库。我加入了#34;议程"控制到我的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);
答案 0 :(得分:0)
是的,不需要教程,每个人偶尔犯这个错误;您正在使用LocalDate提供的月份来创建日历。但是,LocalDate的月份从1到12,日历从0到11,所以约会实际上是在今天之后的一个月。
我建议你开始使用Java 8 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);