void clearFocus() { LocalDate focusDate = datePicker.getValue(); if (focusDate == null) { focusDate = LocalDate.now(); } if (YearMonth.from(focusDate).equals(selectedYearMonth.get())) { goToDate(focusDate, true); } }
protected void updateMonthYearPane() { // update date labels YearMonth yearMonth = selectedYearMonth.get(); LocalDate value = datePicker.getValue(); value = value == null ? LocalDate.now() : value; selectedDateLabel.setText(DateTimeFormatter.ofPattern("EEE, MMM dd").format(value)); selectedYearLabel.setText(formatYear(yearMonth)); monthYearLabel.setText(formatMonth(yearMonth) + " " + formatYear(yearMonth)); Chronology chrono = datePicker.getChronology(); LocalDate firstDayOfMonth = yearMonth.atDay(1); backMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, -1, DAYS)); forwardMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, +1, MONTHS)); }
if (date.equals(datePicker.getValue())) { dayCell.getStyleClass().add("selected"); dayCell.setTextFill(Color.WHITE);
getStyleClass().add("date-picker-popup"); LocalDate date = datePicker.getValue(); selectedYearMonth.set((date != null) ? YearMonth.from(date) : YearMonth.now()); selectedYearMonth.addListener((observable, oldValue, newValue) -> updateValues());
void clearFocus() { LocalDate focusDate = datePicker.getValue(); if (focusDate == null) { focusDate = LocalDate.now(); } if (YearMonth.from(focusDate).equals(selectedYearMonth.get())) { goToDate(focusDate, true); } }
protected void updateMonthYearPane() { // update date labels YearMonth yearMonth = selectedYearMonth.get(); LocalDate value = datePicker.getValue(); value = value == null ? LocalDate.now() : value; selectedDateLabel.setText(DateTimeFormatter.ofPattern("EEE, MMM dd").format(value)); selectedYearLabel.setText(formatYear(yearMonth)); monthYearLabel.setText(formatMonth(yearMonth) + " " + formatYear(yearMonth)); Chronology chrono = datePicker.getChronology(); LocalDate firstDayOfMonth = yearMonth.atDay(1); backMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, -1, DAYS)); forwardMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, +1, MONTHS)); }
if (date.equals(datePicker.getValue())) { dayCell.getStyleClass().add("selected"); dayCell.setTextFill(Color.WHITE);
getStyleClass().add("date-picker-popup"); LocalDate date = datePicker.getValue(); selectedYearMonth.set((date != null) ? YearMonth.from(date) : YearMonth.now()); selectedYearMonth.addListener((observable, oldValue, newValue) -> updateValues());