Example usage for java.util.prefs PreferenceChangeEvent getNewValue

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

Introduction

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

Prototype

public String getNewValue() 

Source Link

Document

Returns the new value for the preference.

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();
        }//from w w  w . j av  a2s.  c  o  m
    });
    prefs.put("key", "a string");
    prefs.put("key", "a new string");
    prefs.remove("key");
}

From source file:Main.java

public void preferenceChange(PreferenceChangeEvent evt) {
    String key = evt.getKey();/* w w  w  . ja  va 2  s .com*/
    String val = evt.getNewValue();
    if (key.equals(NAMEPREF)) {
        System.out.println(val);
    } else if (key.equals(EMAILPREF)) {
        System.out.println(val);
    }
}

From source file:MainClass.java

public void preferenceChange(PreferenceChangeEvent evt) {

    String key = evt.getKey();/*from   w  w  w .j a  v  a 2s  .c  om*/
    String val = evt.getNewValue();

    if (key.equals(NAMEPREF)) {
        System.out.println(val);
    } else if (key.equals(EMAILPREF)) {
        System.out.println(val);
    } else if (key.equals(AGEPREF)) {
        System.out.println(val);
    } else if (key.equals(PHONEPREF)) {
        System.out.println(val);
    }
}

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());
}