0

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

1 に答える 1

0

ええ、チュートリアルは必要ありません。誰もが時々犯すこの間違いです。LocalDate が提供する月を使用してカレンダーを作成しています。ただし、LocalDate の月は 1 から 12 まで、Calendar は 0 から 11 までなので、予定は実際には今日から 1 か月後になります。

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);
于 2015-07-28T05:50:15.273 に答える