Article View: borland.public.jbuilder.java.swing
Article #8187Re: How to get the object of the JTree
From: Scott Yaung
Date: Thu, 12 Oct 2000 00:00
Date: Thu, 12 Oct 2000 00:00
23 lines
1350 bytes
1350 bytes
Hi , Yes ,but by the Event Listener of Tree ,no more information is provided only a tree path .So It is the same I can not get the TreeNode object by listen to that event . B.R. Scott Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> wrote in message news:uhf6vzq4f.fsf@sds.no... > "Scott Yaung" <gzscott@21cn.com> writes: > > > Hi JavaGuru, > > In my case ,I use JTree to list a department of a company,but if in the > > same department ,there are two people > > with the same name,the getSelectionPath() return the same result.So how can > > I know which is one been selected by JTree Method? > > You need to use a custom TreeNode (or, if you use DMTN, a custom > "userObject") which you can query for some ID, and not just rely on > the toString() description used by the default TreeCellRenderer.
Technical Details
Message-ID:
<8s3tek$63313@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8r2d51$2la6@bornews.borland.com> <uhf6vzq4f.fsf@sds.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8dc88ad7f30331e0 X-Google-Attributes: gid111d45,public From: "Scott Yaung" <gzscott@21cn.com> Subject: Re: How to get the object of the JTree Date: 2000/10/12 Message-ID: <8s3tek$63313@bornews.borland.com> X-Deja-AN: 680490632 References: <8r2d51$2la6@bornews.borland.com> <uhf6vzq4f.fsf@sds.no> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Newsgroups: borland.public.jbuilder.java.swing