Home Java Example Java Util Creating a Preference Node



Creating a Preference Node
Posted on: January 7, 2009 at 12:00 AM
This section demonstrates you to create a Preference Node in C. As you know that there are two types of Preference nodes, User Preference Node and System Preference Node.

Creating a Preference Node

     

This section demonstrates you to create a Preference Node in C. As you know that there are two types of Preference nodes, User Preference Node and System Preference Node. Here we are going to create a user preference node. The method userRoot() provided by the Preferences class returns the root preference node for the calling user and node("/Roseindia Employees") method creates the specified node if the node does not exists. In order to show the created node in the Preference tree, we have used the method exportSubtree()  which emits an XML document representing all of the preferences contained in the node and all of its descendants on the console.

Here is the code:

import java.util.prefs.*;
import java.io.IOException;
public class CreateNode{
  public static void main(String[] args) throws IOException, BackingStoreException { 
        Preferences.userRoot().node("/Roseindia Employees");
        Preferences root = Preferences.userRoot();
        root.exportSubtree(System.out);
  }
   }

Output will be displayed as:

Download Source Code:

 

Related Tags for Creating a Preference Node :
creferenceiotypesusertypesystemthisnodecreatetorefedessectionnodesdemousepeceinnoasmtresemrateratessysrefersatkishapregoeaandarstrtwssrenthsthatfeprpreferencendodeono


More Tutorials from this section

Ask Questions?    Discuss: Creating a Preference Node  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.