Name

PreferenceChangeEvent

Synopsis

A PreferenceChangeEvent object is passed to the preferenceChange( ) method of any PreferenceChangeListener objects registered on a Preferences object whenever a preferences value is added to, removed from, or modified in that Preferences node. getNode( ) returns the affected Preferences object. getKey( ) returns name of the modified preference. If the preference value was added or modified, getNewValue( ) returns that value. If a preference was deleted, getNewValue( ) returns null.

Although this class inherits the Serializable interface, it is not actually serializable.

java.util.prefs.PreferenceChangeEvent

Figure 16-129. java.util.prefs.PreferenceChangeEvent

public class PreferenceChangeEvent extends java.util.EventObject {
// Public Constructors
     public PreferenceChangeEvent(Preferences node, String key, String newValue);  
// Public Instance Methods
     public String getKey( );  
     public String getNewValue( );  
     public Preferences getNode( );  
}

Passed To

PreferenceChangeListener.preferenceChange( )

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.