Thursday, December 07, 2006

获取优先级树的根节点 (java参考中文站--例子,代码,实例)

获取优先级树的根节点 (java参考中文站--例子,代码,实例): "e411. 获取优先级树的根节点
There are two preference trees --- the system tree and the user tree. The root of these trees is retrieved using Preferences.systemRoot() and Preferences.userRoot(). The roots are required when creating and retrieving preference nodes. See e413 检索一个优先级节点 for an example of retrieving preference nodes using a root.

// 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();"