Object () { Enumeration e = myStack.peek(); Object node = e.nextElement(); if (!e.hasMoreElements()) { myStack.pop(); } Enumeration children = new ChildrenEnumeration(myTreeModel, node); if (children.hasMoreElements()) { myStack.push(children); } return node; }