🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11490

JTree of objects other than String but displaying String, possible?

#11490
From: Jabber
Date: Wed, 26 May 1999 00:00
7 lines
871 bytes
I am trying to create a JTree of my own defined objects, rather than
Strings. This in itself is easy:
    child = new DefaultMutableTreeNode(new MyObject);
    parent.add(child);
However, I would like to see a String attribute of MyObject as the label
for the node in the tree, rather than the MyObject.toString(); of it. Is
there a way to do this?
Technical Details
Message-ID: <374C580D.635E4D78@tiac.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,7b988e188e65d939,start
X-Google-Attributes: gid111d45,public
From: Jabber <jabber@tiac.net>
Subject: JTree of objects other than String but displaying String, possible?
Date: 1999/05/26
Message-ID: <374C580D.635E4D78@tiac.net>
X-Deja-AN: 482446474
Content-Transfer-Encoding: 7bit
Organization: undisclosed
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing