e416. retrieving the parent and child nodes of a preference node.txt

来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 19 行

TXT
19
字号
// 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]);
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?