Menu

#1 Date Change Listener

open
nobody
None
5
2004-04-27
2004-04-27
No

This patch is for the current CVS HEAD stream. It will enable a
user to create listeners for the DatePicker class that will be
informed when the date is changed. I found this useful as I was
using the DatePicker in a popup menu, where the user action of
clicking on the day required the popup menu to be updated.

I have used the following code to create and use the listener:

dateField.addDateChangedListener(new
DatePicker.DateChangedListener() {
public void dateChanged(DateChangeEvent e) {
DatePicker picker = e.getDatePicker();
Date chosenDate = picker.getDate();
// Do something interesting with the chosen date!
});

I hope this helps anyone.

Thanks

CraigP

Discussion

  • Craig Pugsley

    Craig Pugsley - 2004-04-27

    The patch is created from the head stream using Eclipse 3.0 to create a 'context' patch.

     
  • Craig Pugsley

    Craig Pugsley - 2004-04-27

    Logged In: YES
    user_id=1026922

    Ooops. Missed a bracket in that code there. The code should read:

    dateField.addDateChangedListener(new
    DatePicker.DateChangedListener() {
    public void dateChanged(DateChangeEvent e) {
    DatePicker picker = e.getDatePicker();
    Date chosenDate = picker.getDate();
    // Do something interesting with the chosen date!
    }
    });

     

Log in to post a comment.