javajdatechooser

2 jDateChooser how to disable the date of other jDatechooser


I have 2 jdatechooser, 1 is for check in and 1 is for checkout. How can I disable the date of my jdatechooser checkout if my jdatechooser check in is selected the date today and the checkout will disable the date yesterday or I set the checkin date Oct-20-2016 the checkout will disable the date from Oct-20-2016 Oct-19-2016 Oct-18-2016 like that...

jDateChooser2.setValue(jDateChooser1.getValue().plusDays(1));

https://i.sstatic.net/l8zxj.png


Solution

  • After a date has been selected in dateChooser1 , if Date date is the minimum allowed date, use:

    jDateChooser2.getJCalendar().setMinSelectableDate(date);