Get keys from Preferences : Preference Properties « Development Class « Java






Get keys from Preferences

Get keys from Preferences
      

import java.io.FileOutputStream;
import java.util.prefs.Preferences;

public class PreferenceExample {
  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.print("Node's keys: ");
    for (String s : myPrefs.keys()) {
      System.out.print(s + "");
    }
  }
}

          
    
    
    
    
  








Related examples in the same category

1.Put key value pair to PreferencePut key value pair to Preference
2.Get childrenNames from PreferencesGet childrenNames from Preferences
3.Get name and parent from PreferenceGet name and parent from Preference
4.Get node from PreferenceGet node from Preference
5.Get value from PreferencesGet value from Preferences
6.Export Preferences to XML fileExport Preferences to XML file
7.Passing references aroundPassing references around
8.Retrieve the preference node using a Class object and saves and retrieves a preference in the node.
9.Determining If a Preference Node Contains a Specific Key
10.Determining If a Preference Node Contains a Specific Value
11.Removing a Preference from a Preference Node
12.Getting and Setting Java Type Values in a Preference
13.Getting the Maximum Size of a Preference Key and Value
14.Getting the Roots of the Preference Trees
15.Retrieving a Preference Node
16.Removing a Preference Node
17.Determining If a Preference Node Exists
18.Retrieving the Parent and Child Nodes of a Preference Node
19.Exporting the Preferences in a Preference Node
20.Exporting the Preferences in a Subtree of Preference Nodes
21.Determining When a Preference Node Is Added or Removed
22.Read / write data in Windows registry
23.Listening for Changes to Preference Values in a Preference Node
24.Saving Data with the Preferences APISaving Data with the Preferences API
25.Preference Example:: export To FilePreference Example:: export To File
26.Properties load
27.Properties TreeMap and StreamProperties TreeMap and Stream
28.Parse Properties FilesParse Properties Files
29.Preferences DemoPreferences Demo
30.Properties TestProperties Test
31.Sort Properties when saving
32.Loading configuration parameters from text file based properties
33.To read a Properties file via an Applet
34.A Properties file stored in a JAR can be loaded this way
35.Load a properties file in the startup directory
36.Have a multi-line value in a properties file
37.Convert a Properties list into a map.
38.Listing All System Properties
39.Getting and Setting Properties
40.Use XML with Properties
41.Store properties as XML file
42.Reading and Writing a Properties File
43.Read system property as an integer
44.Read a configuration file using java.util.Properties
45.Load properties from XML file
46.Here is an example of the contents of a properties file:
47.Use the Registry to store informations (Preferences API)
48.Load a properties file in the classpath
49.Listing the system properties
50.Properties Demo
51.PropsToXML takes a standard Java properties file, and converts it into an XML file
52.Utility class for preferences
53.Static methods for retrieving and system properties and converting them to various types
54.Store recent items (e.g. recent file in a menu or recent search text in a search dialog)
55.Storing/loading Preferences
56.A frame that restores position and size from user preferences and updates the preferences upon exit
57.A frame that restores position and size from a properties file and updates the properties upon exitA frame that restores position and size from a properties file and updates the properties upon exit
58.A simple Properties extension easing the loading and saving of data