![]() |
The Java Developers Almanac 1.4 |
|
e416. Retrieving the Parent and Child Nodes of a Preference Node // Get a node
Preferences prefs = Preferences.userNodeForPackage(java.lang.String.class);
// Get the parent
Preferences node = prefs.parent(); // /java
node = node.parent(); // null
// Get the names for nodes under java.lang
String[] names = null;
try {
names = prefs.childrenNames();
} catch (BackingStoreException e) {
}
// Get the child nodes using the names
for (int i=0; i<names.length; i++) {
node = prefs.node(names[i]);
}
e412. Creating a Preference Node e413. Retrieving a Preference Node e414. Removing a Preference Node e415. Determining If a Preference Node Exists e417. Finding a Preference in a Preference Tree
© 2002 Addison-Wesley. |