简体   繁体   中英

Hide all date before the selected date in another JxDatePicker

In my case, I have in my program 2 JxDatePicker, the 1st one for recording the date of entry, and 2nd one for recording the date of exit in a Hotel. I need when I chose a date from the start JxDatePicker to disable all the date before this date in the end JxDatePicker. something like RangeEvaluator but I do not know how to do it.

As far as I know, you only use JXDatePicker for single day selection from a monthly calendar. For interval-selection (start-end), you may want to look into JXMonthView

EDIT: May have found you answer You can not sent a range but you can set upper bounds and lower bounds, which may basically be the same in your case. Try the following example:

JXDatePicker picker = new JXDatePicker();
Calendar calendar = picker.getMonthView().getCalendar();

// set any date to it (for e.g. today)
calendar.setTime(new Date());
picker.getMonthView().setLowerBound(calendar.getTime());

// set it to end when you want
CalendarUtils.endOfWeek(calendar);
calendar.add(Calendar.WEEK_OF_YEAR);
picker.getMonthView().setUpperBound(calendar.getTime());

Try this example separately, see if it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM