如何在JavaFx8的Datepicker Calander中设置最小和最大日期? [英] How to set Minimum and maximum date in Datepicker Calander in JavaFx8?
本文介绍了如何在JavaFx8的Datepicker Calander中设置最小和最大日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助.
我们如何在javafx8的日期选择器日历中设置最小和最大日期?
How Can we set min and max date in date picker calendar in javafx8?
推荐答案
或者为什么
minDate = LocalDate.of(1989, 4, 16);
maxDate = LocalDate.now();
datePicker.setDayCellFactory(d ->
new DateCell() {
@Override public void updateItem(LocalDate item, boolean empty) {
super.updateItem(item, empty);
setDisable(item.isAfter(maxDate) || item.isBefore(minDate));
}});
无需创建额外的日期选择器来存储最长日期.
No need to create an extra datepicker just to store the max date.
这篇关于如何在JavaFx8的Datepicker Calander中设置最小和最大日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文