Package java.util.prefs
Class PreferenceChangeEvent
- java.lang.Object
-
- java.util.EventObject
-
- java.util.prefs.PreferenceChangeEvent
-
- All Implemented Interfaces:
Serializable
public class PreferenceChangeEvent extends EventObject implements Serializable
This is the event class to indicate that a preference has been added, deleted or updated.Please note that although the class is marked as
Serializableby inheritance fromEventObject, this type is not intended to be serialized so the serialization methods do nothing but throw aNotSerializableException.- Since:
- 1.4
- See Also:
Preferences,PreferenceChangeListener, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description PreferenceChangeEvent(Preferences p, String k, String v)Construct a newPreferenceChangeEventinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetKey()Gets the key of the changed preference.StringgetNewValue()Gets the new value of the changed preference ornullif the preference has been removed.PreferencesgetNode()Gets thePreferencesinstance that fired this event.-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Constructor Detail
-
PreferenceChangeEvent
public PreferenceChangeEvent(Preferences p, String k, String v)
Construct a newPreferenceChangeEventinstance.- Parameters:
p- thePreferencesinstance that fired this event; this object is considered as the event's source.k- the changed preference key.v- the new value of the changed preference, this value can benull, which means the preference has been removed.
-
-
Method Detail
-
getKey
public String getKey()
Gets the key of the changed preference.- Returns:
- the changed preference's key.
-
getNewValue
public String getNewValue()
Gets the new value of the changed preference ornullif the preference has been removed.- Returns:
- the new value of the changed preference or
nullif the preference has been removed.
-
getNode
public Preferences getNode()
Gets thePreferencesinstance that fired this event.- Returns:
- the
Preferencesinstance that fired this event.
-
-