Converts ValueModels to the ColorSelectionModel interface. Useful to bind
JColorChooser and similar classes to a ValueModel.
Constraints: The subject ValueModel must be of type Color
and must allow read-access to its value. Also, it is strongly recommended
(though not required) that the underlying ValueModel provides only non-null
values. This is so because the ColorSelectionModel behavior is undefined
for null values and it may have unpredictable results.
Examples:
// Recommended binding style using a factory
ValueModel model = presentationModel.getModel(MyBean.PROPERTYNAME_COLOR);
JColorChooser colorChooser = BasicComponentFactory.createColorChooser(model);
// Binding using the Bindings class
ValueModel model = presentationModel.getModel(MyBean.PROPERTYNAME_COLOR);
JColorChooser colorChooser = new JColorChooser();
Bindings.bind(colorChooser, model);
// Hand-made binding
ValueModel model = presentationModel.getModel(MyBean.PROPERTYNAME_COLOR);
JColorChooser colorChooser = new JColorChooser(new ColorSelectionAdapter(model));
author: Karsten Lentzsch version: $Revision: 1.7 $ See Also: javax.swing.colorchooser.ColorSelectionModel See Also: javax.swing.JColorChooser since: 1.0.3 |