📄 preferencechangeevent.java
字号:
/* * @(#)PreferenceChangeEvent.java 1.4 03/01/23 * * Copyright 2003 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package java.util.prefs;import java.io.NotSerializableException;/** * An event emitted by a <tt>Preferences</tt> node to indicate that * a preference has been added, removed or has had its value changed.<p> * * 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.4, 01/23/03 * @see Preferences * @see PreferenceChangeListener * @see NodeChangeEvent * @since 1.4 * @serial exclude */public class PreferenceChangeEvent extends java.util.EventObject { /** * Key of the preference that changed. * * @serial */ private String key; /** * New value for preference, or <tt>null</tt> if it was removed. * * @serial */ private String newValue; /** * Constructs a new <code>PreferenceChangeEvent</code> 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 <tt>null</tt> * if the preference is being removed. */ public PreferenceChangeEvent(Preferences node, String key, String newValue) { super(node); this.key = key; this.newValue = newValue; } /** * Returns the preference node that emitted the event. * * @return The preference node that emitted the event. */ public Preferences getNode() { return (Preferences) getSource(); } /** * Returns the key of the preference that was changed. * * @return The key of the preference that was changed. */ public String getKey() { return key; } /** * Returns the new value for the preference. * * @return The new value for the preference, or <tt>null</tt> if the * preference was removed. */ public String getNewValue() { return newValue; } /** * Throws NotSerializableException, since NodeChangeEvent objects * are not intended to be serializable. */ private void writeObject(java.io.ObjectOutputStream out) throws NotSerializableException { throw new NotSerializableException("Not serializable."); } /** * Throws NotSerializableException, since PreferenceChangeEvent objects * are not intended to be serializable. */ private void readObject(java.io.ObjectInputStream in) throws NotSerializableException { throw new NotSerializableException("Not serializable."); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -