如何动态设置从其他JDateChooser中选择的JDateChooser中的最小日期?

问题描述

我有2个JDateChooserstartDateendDate

  1. 我想将startDate的最小日期设置为当前日期,

  2. 我从startDate中选择日期,它应该是endDate的最小日期,并且应该选择它。如何动态设置最小日期?

datechStartD = new JDateChooser(new Date());    
Calendar c=Calendar.getInstance();;
datechStartD.getCalendarButton().addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent arg0) {
        c.setTime(datechStartD.getDate() );
        c.add(Calendar.DATE,5);  // adding next start date
                
        dateChooserEndD.getJCalendar().setMinSelectableDate(c.getTime());
    }
});             
datechStartD.setBounds(180,144,150,30);
datechStartD.getJCalendar().setMinSelectableDate(new Date());
       
dateChooserEndD = new JDateChooser();       
dateChooserEndD.setBounds(180,198,30);

GUI of the Start date and endDate

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)