FileDocCategorySizeDatePackage
PreferenceChangeEvent.javaAPI DocJava SE 5 API3222Fri Aug 26 14:57:28 BST 2005java.util.prefs

PreferenceChangeEvent

public class PreferenceChangeEvent extends EventObject
An event emitted by a Preferences node to indicate that a preference has been added, removed or has had its value changed.

Note, that although PreferenceChangeEvent inherits Serializable interface from EventObject, it is not intended to be Serializable. Appropriate serialization methods are implemented to throw NotSerializableException.

author
Josh Bloch
version
1.6, 12/19/03
see
Preferences
see
PreferenceChangeListener
see
NodeChangeEvent
since
1.4
serial
exclude

Fields Summary
private String
key
Key of the preference that changed.
private String
newValue
New value for preference, or null if it was removed.
private static final long
serialVersionUID
Constructors Summary
public PreferenceChangeEvent(Preferences node, String key, String newValue)
Constructs a new PreferenceChangeEvent instance.

param
node The Preferences node that emitted the event.
param
key The key of the preference that was changed.
param
newValue The new value of the preference, or null if the preference is being removed.

	super(node);
	this.key = key;
	this.newValue = newValue;
    
Methods Summary
public java.lang.StringgetKey()
Returns the key of the preference that was changed.

return
The key of the preference that was changed.

	return key;
    
public java.lang.StringgetNewValue()
Returns the new value for the preference.

return
The new value for the preference, or null if the preference was removed.

	return newValue;
    
public java.util.prefs.PreferencesgetNode()
Returns the preference node that emitted the event.

return
The preference node that emitted the event.

        return (Preferences) getSource();
    
private voidreadObject(java.io.ObjectInputStream in)
Throws NotSerializableException, since PreferenceChangeEvent objects are not intended to be serializable.

         throw new NotSerializableException("Not serializable.");
     
private voidwriteObject(java.io.ObjectOutputStream out)
Throws NotSerializableException, since NodeChangeEvent objects are not intended to be serializable.

         throw new NotSerializableException("Not serializable.");