sheet.readFromObject(bean);
// everytime a property change, update the button with it
listener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Property prop = (Property)evt.getSource();
try {
prop.writeToObject(BeanBinder.this.bean);
} catch (RuntimeException e) {
// handle PropertyVetoException and restore previous value
if (e.getCause() instanceof PropertyVetoException) {
UIManager.getLookAndFeel().provideErrorFeedback(
BeanBinder.this.sheet);
prop.setValue(evt.getOldValue());
}
}
}
};
sheet.addPropertySheetChangeListener(listener);