🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.gui
Article #64

Re: How do I walk thru an entire TreeModel?

#64
From: David Shepherd
Date: Tue, 17 Nov 1998 00:00
34 lines
1849 bytes
I solved the problem by RTFM.
Using either DefaultMutableTreeNode.breadthFirstEnumeration() or
DefaultMutableTreeNode.depthFirstEnumeration() works!!

David Shepherd wrote:

> I'm using the DefaultTreeModel and I need to do a couple of things to
> all the nodes in the tree.
>
> The first is find TreeNodes based on some criteria in the UserObject.
> The second is to remove all the nodes from the tree except the root
> node.
>
> I can't find any API calls to do a walk through all the nodes.
> (DefaultMutableTreeNode.children() only gives an Enumeration of that
> nodes children, not the children's children etc)
>
> Anyone written some nifty recursive functions to do this?
>
> Thanks in advance
>
> --
> David Shepherd
> Java Application Developer
> Systems Development
> Southern Cross Healthcare
> email: davids@sxhealth.co.nz

--
David Shepherd
Java Application Developer
Systems Development
Southern Cross Healthcare
email: davids@sxhealth.co.nz
Technical Details
Message-ID: <365081CB.A40C4BEB@sxhealth.co.nz>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <364F8E1F.4746D6E5@sxhealth.co.nz>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,bdb928d20fdb2bfd,start
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,bdb928d20fdb2bfd,start
X-Google-Attributes: gid10fd6d,public
From: David Shepherd <davids@sxhealth.co.nz>
Subject: Re: How do I walk thru an entire TreeModel?
Date: 1998/11/17
Message-ID: <365081CB.A40C4BEB@sxhealth.co.nz>
X-Deja-AN: 412549947
Content-Transfer-Encoding: 7bit
References: <364F8E1F.4746D6E5@sxhealth.co.nz>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsadmin@xtra.co.nz
X-Trace: titan.xtra.co.nz 911245978 21145 210.55.195.181 (16 Nov 1998 19:52:58 GMT)
Organization: Customer of Telecom Internet Services
Mime-Version: 1.0
NNTP-Posting-Date: 16 Nov 1998 19:52:58 GMT
Newsgroups: comp.lang.java.gui,borland.public.jbuilder.java.swing