java.util.prefs

Class PreferenceChangeEvent

public class PreferenceChangeEvent extends EventObject

ObjectEvent fired when a Preferences entry changes. This event is generated when a entry is added, changed or removed. When an entry is removed then getNewValue will return null.

Preference change events are only generated for entries in one particular preference node. Notification of subnode addition/removal is given by a NodeChangeEvent.

Note that although this class is marked as serializable, attempts to serialize it will fail with NotSerializableException.

Since: 1.4

Constructor Summary
PreferenceChangeEvent(Preferences node, String key, String value)
Creates a new PreferenceChangeEvent.
Method Summary
StringgetKey()
Returns the key of the entry that was added, changed or removed.
StringgetNewValue()
Returns the new value of the entry that was added or changed, or returns null when the entry was removed.
PreferencesgetNode()
Returns the source Preference node from which an entry was added, changed or removed.

Constructor Detail

PreferenceChangeEvent

public PreferenceChangeEvent(Preferences node, String key, String value)
Creates a new PreferenceChangeEvent.

Parameters: node The source preference node for which an entry was added, changed or removed key The key of the entry that was added, changed or removed value The new value of the entry that was added or changed, or null when the entry was removed

Method Detail

getKey

public String getKey()
Returns the key of the entry that was added, changed or removed.

getNewValue

public String getNewValue()
Returns the new value of the entry that was added or changed, or returns null when the entry was removed.

getNode

public Preferences getNode()
Returns the source Preference node from which an entry was added, changed or removed.