Date Change Listener
Brought to you by:
bbell2000
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
The patch is created from the head stream using Eclipse 3.0 to create a 'context' patch.
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!
}
});