Question: A program I'm writing allows users to click a date on a JXDatePicker to set the date a task has been completed. I would like to disable the selection of future dates in the JXDatePicker, since in my program selecting future dates is invalid.

I have found that JXDatePickers contain a JXMonthView, and it does not seem that date pickers or month views allow you to disable individual/ranges of dates. I can change the background coloring of individual dates and ranges of dates, which should allow me to make future dates a separate color. Then I could add in some validation whenever the user clicks the calendar to disallow future dates. However, it would be so much cleaner if I could just say something like calendar.setMaxDate(today);

Does anyone know if there is an easier method of doing this than hand-coding the functionality? Perhaps another date picker component fixes this problem?

Answer: 
If you want to restrict date selection to only a range, you can specify upper and lower boundries

```
JXDatePicker picker = new JXDatePicker();
Calendar calendar = picker.getMonthView().getCalendar();
// starting today if we are in a hurry
calendar.setTime(new Date());
picker.getMonthView().setLowerBound(calendar.getTime());
// end of next week
CalendarUtils.endOfWeek(calendar);
calendar.add(Calendar.WEEK_OF_YEAR);
picker.getMonthView().setUpperBound(calendar.getTime());

```

(Taken from the JavaDocs)

This will basically restrict the valid, selectable dates from today to the end of the week.
```
        Callback<DatePicker, DateCell> callB = new Callback<DatePicker, DateCell>() {
            @Override
            public DateCell call(final DatePicker param) {
                return new DateCell() {
                    @Override
                    public void updateItem(LocalDate item, boolean empty) {
                        super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates.
                        LocalDate today = LocalDate.now();
                        setDisable(empty || item.compareTo(today) < 0);
                    }

                };
            }

        };
        selectedDate.setDayCellFactory(callB);

```

date disable.......