The JDatePicker suite can be used with the JGoodies data binding framework. This section uses the application shown below to demonstrate that.
Try this:
Run DataBindingDemo using Java Web Start or consult the source code for yourself.
Modify the dates or the task name. The changes will be notified in the bottom text area.
Click the Reset Dates button to modify the underlying model. The changes will be reflected by the date components.
In order to allow the date editing components to work with the binding framework, we provide an adapter for ValueModels. The DateEditComponentAdapter converts ValueModels to DateModels that are specific for the date edit components.
ValueModel model = new PropertyAdapter(book, "published", date); JDateField dateField = new JDateField(); DateEditComponentAdapter.bind(dateField, model);
The adapter is placed in the jdatepicker-binding.jar file. Be sure to include it in your classpath. You can also access the adapter's source code to see how it is implemented. See the src/binding directory.