set the minimum date selectable as 15 years after my date of birth (from mySQL) and max as the date of the day


I have a mySQL table of users containing the users' birthdays. i have stored the date from sql as the variable DateOfBirth. Now, I want to set the minimum selectable date of a jDateChooser named GameDateChooser as 15 years past the birthday and the maximum selectable date to the current date. i tried searching for other articles but they didnt answer my question

From java doc there are setSelectableDateRange, which can accept two dates, min and max :

public void setSelectableDateRange(java.util.Date min, java.util.Date max)

In your case you need something like this :

Calendar cal = Calendar.getInstance();
cal.add(Calendar.YEAR, -15);//15 year before
Date min = cal.getTime();

Date max = new Date();//actual date

JDateChooser jDateChooser = new JDateChooser();
//set your dates in your JDateChooser
jDateChooser.setSelectableDateRange(min, max);