Sandah Aung
Sandah Aung

Reputation: 6188

Calendar control using FXML

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?

Upvotes: 0

Views: 1728

Answers (1)

tbeernot
tbeernot

Reputation: 2612

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

Upvotes: 1

Related Questions