cannot make Datecombobox changelistener work !?

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

cannot make Datecombobox changelistener work !?

Postby curvenut » Wed May 18, 2016 6:12 am

Hi,

I am using the DateComboBox.
I am trying to register a listener when the date change so I can get the new date the user just selected.
It doesn't seems to work.

Here a code snippet I use :


Code: Select all
       DateModel dateModel;
       DateComboBox dateCB = new DateComboBox();

       dateCB.setCalendar(Calendar.getInstance());

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        dateCB.setFormat(dateFormat);
       
        dateModel = dateCB.getDateModel();
       
        dateModel.addDateModelListener( new DateModelListener() {
         
         @Override
         public void dateModelChanged(DateModelEvent arg0) {
            
            Date date = dateCB.getDate();
            
            System.out.println(" New date  = " + date.toString());
            
         }
   });



When I change the date in the combo box, it dosent print the "new date " .

Did I miss something ?

Thanks for your help !
curvenut
 
Posts: 4
Joined: Tue May 17, 2016 7:29 am

Re: cannot make Datecombobox changelistener work !?

Postby JIDE Support » Wed May 18, 2016 8:55 am

Please use addItemListener just like in a JComboBox. The date model was not changed when the selection changes.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37250
Joined: Sun Sep 14, 2003 10:49 am

Re: cannot make Datecombobox changelistener work !?

Postby curvenut » Fri May 20, 2016 10:54 am

Thanks it works.
curvenut
 
Posts: 4
Joined: Tue May 17, 2016 7:29 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 2 guests

cron