@Override
    public void simpleInitApp() {
        
        // setup scene graph
        Node n1 = new Node("town");
        rootNode.attachChild(n1);
            n1.attachChild(new Node("car"));
            n1.attachChild(new Node("tree"));
            Node n2 = new Node("house");
            n1.attachChild(n2);
                n2.attachChild(new Node("chairs"));
                n2.attachChild(new Node("tables"));
                n2.attachChild(createGeometry("house-geometry"));
        Node n3 = new Node("sky");
        rootNode.attachChild(n3);
            n3.attachChild(new Node("airplane"));
            Node ignore = new Node("cloud");
            n3.attachChild(ignore);
                ignore.attachChild(new Node("XXX"));
                ignore.attachChild(new Node("XXX"));
                ignore.attachChild(new Node("XXX"));
            n3.attachChild(new Node("bird"));
        
        // iterate
        SceneGraphIterator iterator = new SceneGraphIterator(rootNode);
        for (Spatial spatial : iterator) {
            // create a hierarchy in the console
            System.out.println(constructTabs(iterator.getDepth()) + spatial.getName());
            // see if the children of this spatial should be ignored
            if (spatial == ignore) {
                // ignore all children of this spatial
                iterator.ignoreChildren();
            }
        }
        
        // exit the application
        stop();
        
    }
Launches the test application.

@param args no argument required
jme3-examples/src/main/java/jme3test/scene/TestSceneIteration.java