Java Preference Put setUserString(final String preferencesGroup, final String preferenceName, final String value)

Here you can find the source of setUserString(final String preferencesGroup, final String preferenceName, final String value)

Description

set User String

License

Apache License

Declaration

public static void setUserString(final String preferencesGroup, final String preferenceName,
            final String value) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.prefs.Preferences;

public class Main {
    public static void setUserString(final String preferencesGroup, final String preferenceName,
            final String value) {
        final Preferences preferences = getUserPreferences(preferencesGroup);
        preferences.put(preferenceName, value);
    }/* ww w.j a v a  2 s. co m*/

    public static Preferences getUserPreferences(final String preferenceGroup) {
        final Preferences userRoot = Preferences.userRoot();
        final Preferences preferences = userRoot.node(preferenceGroup);
        return preferences;
    }
}

Related

  1. putList(String path, ArrayList list)
  2. putPrefsBoolean(Preferences prefs, String key, boolean value, boolean def)
  3. putPrefsStrings(Preferences prefs, String key, String[] strings)
  4. setLocale(final Locale l)
  5. setPrefBoolean(Object context, final String key, final boolean value)
  6. storeDiff(Preferences prefs, String key, int prev, int val, int defVal)
  7. storeNotDef(Preferences prefs, String key, boolean val, boolean defVal)