Print at Dec 19, 2025, 6:56:28 AM

Posted by enkonyito at Jun 7, 2017, 2:15:35 AM
Add a new home property to a change listener
The setProperty method allow to set a new property associated with a home.
But can this property be taken into account by the addPropertyChangeListener method without returning an IllegalArgumentException if you use valueOf (String name)?

With this code:
this.home.addPropertyChangeListener(Home.Property.valueOf(ENHANCED_EXTERNAL_BRIGHTNESS),
new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent ev) {
isEnhancedExternalBrightness = Boolean.parseBoolean(home.getProperty(ENHANCED_EXTERNAL_BRIGHTNESS));
externalBrightnessEnabledCheckBox.setSelected(isEnhancedExternalBrightness);
}
});

I have this error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No enum constant com.eteks.sweethome3d.model.Home.Property.enhancedExternalBrightness

----------------------------------------
EnkoNyito