I just released this javafx component on github under the liberal MIT license.
There are two versions:
- YearMonthPickerCombo – a combobox that return a YearMonth.
- YearMonthPicker – A custom control that resembles DatePicker where the user can click a calendar and then pick the desired year month.
See test.alipsa.ymp.YearMonthPickerExample for a simple example of both. Here’s an example screenshot:
Both works similar to a combo box i.e. you do getValue() to get the value and setOnAction() to capture a value change e.g.
YearMonthPicker ymp = new YearMonthPicker(); ymp.setOnAction(a -> System.out.println("Default YearMonthPicker, Value picked was " + ymp.getValue()));
There are no external dependencies, and the jar file is about 40kb so nice and small. You can download the jar file from the release section or add the following to your maven file:
<dependency> <groupId>se.alipsa</groupId> <artifactId>fx-yearmonth-picker</artifactId> <version>1.0.2</version> </dependency>
Below is a screenshot of the YearMonthPicker in action