Calendar control using FXML

1.6k views Asked by At

My JavaFX application uses FXML and in one of its forms, it needs to show appointment dates in a given month. The user can then click a date to add a new appointment. I would like to use JFX Extra's CalendarPicker (here) for this purpose. I don't know if it is the right library but I think CalendarPicker is preferable if it can do the work. Can somebody show me how to do this?

1

There are 1 answers

0
tbeernot On BEST ANSWER

The control project has a CalendarPickerFXMLTest which shows how to do a calendar picker in FXML.

https://github.com/JFXtras/jfxtras/blob/8.0/jfxtras-controls/src/test/resources/jfxtras/scene/control/test/CalendarPickerFXMLTest.fxml

Make sure you add all the required jars to your project, like jfxtras-common and possibly jfxtras-fxml. After accessing the in fxml defined CalendarPicker control in Java, you can set the highlighed calendars list. If the styling of the highlighting doesn't suite you, you can change it in CSS using the .highlight class

https://github.com/JFXtras/jfxtras/blob/8.0/jfxtras-controls/src/main/resources/jfxtras/internal/scene/control/CalendarPicker.css