To correctly register a SystemOption, you need to place a *.settings file somewhere beneath Services/ in your XML layer. Normally you will also create a .shadow somewhere in UI/Services/ to ensure it is displayed to the user in the Options window.

Sometimes people try to put the *.settings file directly in UI/Services/. This will not work correctly. SharedClassObject.findObject will create an instance of your option - but a default instance only, because it only looks in Services/ to find a default or customized version of the option bean. Changes will never be persisted to disk, because findObject does not know of a *.settings file associated with the option and will consider it to be a transient (in-memory) option only. In this situation you might see the symptom that changes are persisted only if you open the Options dialog and select your setting before first attempting to access it from code.

Check the Services API for the full scoop.

Also make sure that you are firing a property change from your setter methods - typically this is done using putProperty(PROP_FOO_BAR, newValue, true) - and that the property name matches the introspected JavaBeans? property name, i.e. for setFooBar the property name should be fooBar. Remember as well that if newValue.equals(oldValue), no property will be fired (standard behavior of java.beans.PropertyChangeSupport) - this can happen if you have a complex structured value type and attempt to modify a portion of the structure without creating a fresh value object, in which case oldValue == newValue.

Source: NetBeans FAQ

Parent Category: Other API Tips