Example usage for java.util.prefs PreferenceChangeEvent getNode

List of usage examples for java.util.prefs PreferenceChangeEvent getNode

Introduction

In this page you can find the example usage for java.util.prefs PreferenceChangeEvent getNode.

Prototype

public Preferences getNode() 

Source Link

Document

Returns the preference node that emitted the event.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Preferences prefs = Preferences.userNodeForPackage(String.class);

    prefs.addPreferenceChangeListener(new PreferenceChangeListener() {
        public void preferenceChange(PreferenceChangeEvent evt) {

            Preferences node = evt.getNode();
            String key = evt.getKey();
            String newValue = evt.getNewValue();
        }/*w w w  . j a  v a 2 s.c  o  m*/
    });
    prefs.put("key", "a string");
    prefs.put("key", "a new string");
    prefs.remove("key");
}

From source file:org.apache.cayenne.modeler.ModelerPreferences.java

public void preferenceChange(PreferenceChangeEvent evt) {
    evt.getNode().put(evt.getKey(), evt.getNewValue());
}

From source file:org.apache.cayenne.modeler.preferences.ModelerPreferences.java

@Override
public void preferenceChange(PreferenceChangeEvent evt) {
    evt.getNode().put(evt.getKey(), evt.getNewValue());
}