List of usage examples for java.util.prefs Preferences name
public abstract String name();
From source file:Main.java
public static void main(String[] argv) throws Exception { // Get the system root Preferences prefs = Preferences.systemRoot(); // Get the user root prefs = Preferences.userRoot(); // The name of a root is "" String name = prefs.name(); // The parent of a root is null Preferences parent = prefs.parent(); // The absolute path of a root is "/" String path = prefs.absolutePath(); }
From source file:PreferenceExample.java
public static void main(String args[]) throws Exception { Preferences prefsRoot = Preferences.userRoot(); Preferences myPrefs = prefsRoot.node("PreferenceExample"); myPrefs.put("A", "a"); myPrefs.put("B", "b"); myPrefs.put("C", "c"); System.out.println("Node's name: " + myPrefs.name()); System.out.println("Node's parent: " + myPrefs.parent()); System.out.println("NODE: " + myPrefs); }
From source file:PreferenceExample.java
public void printInformation(Preferences p) throws BackingStoreException { System.out.println("Node's absolute path: " + p.absolutePath()); System.out.print("Node's children: "); for (String s : p.childrenNames()) { System.out.print(s + " "); }//w w w .j a va 2 s. c o m System.out.println(""); System.out.print("Node's keys: "); for (String s : p.keys()) { System.out.print(s + " "); } System.out.println(""); System.out.println("Node's name: " + p.name()); System.out.println("Node's parent: " + p.parent()); System.out.println("NODE: " + p); System.out.println("userNodeForPackage: " + Preferences.userNodeForPackage(PreferenceExample.class)); System.out.println("All information in node"); for (String s : p.keys()) { System.out.println(" " + s + " = " + p.get(s, "")); } }