APIdia Launch Partner
Top Description Fields Constructors Methods
java.util.prefs

public Class PreferenceChangeEvent

extends EventObject
Class Inheritance
Imports
java.io.NotSerializableException

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
Since
1.4
See Also
Preferences, PreferenceChangeListener, NodeChangeEvent

Field Summary

Modifier and TypeField and Description
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
Inherited from java.util.EventObject:
source

Constructor Summary

AccessConstructor and Description
public
PreferenceChangeEvent(Preferences
The Preferences node that emitted the event.
node
,
String
The key of the preference that was changed.
key
,
String
The new value of the preference, or null if the preference is being removed.
newValue
)

Constructs a new PreferenceChangeEvent instance.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The key of the preference that was changed.
getKey
()

Returns the key of the preference that was changed.

public String

Returns:

The new value for the preference, or null if the preference was removed.
getNewValue
()

Returns the new value for the preference.

public Preferences

Returns:

The preference node that emitted the event.
getNode
()

Returns the preference node that emitted the event.

private void
readObject(ObjectInputStream in)

Throws NotSerializableException, since PreferenceChangeEvent objects are not intended to be serializable.

private void
writeObject(ObjectOutputStream out)

Throws NotSerializableException, since NodeChangeEvent objects are not intended to be serializable.

Inherited from java.util.EventObject:
getSourcetoString

Field Detail

keyback to summary
private String key

Key of the preference that changed.

newValueback to summary
private String newValue

New value for preference, or null if it was removed.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.EventObject.serialVersionUID.

Constructor Detail

PreferenceChangeEventback to summary
public PreferenceChangeEvent(Preferences node, String key, String newValue)

Constructs a new PreferenceChangeEvent instance.

Parameters
node:Preferences

The Preferences node that emitted the event.

key:String

The key of the preference that was changed.

newValue:String

The new value of the preference, or null if the preference is being removed.

Method Detail

getKeyback to summary
public String getKey()

Returns the key of the preference that was changed.

Returns:String

The key of the preference that was changed.

getNewValueback to summary
public String getNewValue()

Returns the new value for the preference.

Returns:String

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

getNodeback to summary
public Preferences getNode()

Returns the preference node that emitted the event.

Returns:Preferences

The preference node that emitted the event.

readObjectback to summary
private void readObject(ObjectInputStream in) throws NotSerializableException

Throws NotSerializableException, since PreferenceChangeEvent objects are not intended to be serializable.

writeObjectback to summary
private void writeObject(ObjectOutputStream out) throws NotSerializableException

Throws NotSerializableException, since NodeChangeEvent objects are not intended to be serializable.