🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTree

#11400
From: Riccardo Scandariato
Date: Tue, 08 Jun 1999 00:00
34 lines
1313 bytes
Quach Hoa Thanh wrote:
> 
> I have 2 DefaultMutableTreeNode in JTree. Everytime I select a TreeNode,
> I would like to add a child node to the selected TreeNode. How can I do
> this?.
> 
> Thank you all for your help.
> 
> Thanh

Define your own TreeSelectionModel extendind DefaultTreeSelectionModel.
Override

	protected void fireValueChanged(TreeSelectionEvent e){

		super.fireValueChanged(e);

		// obtain actual path
		/* DefaultTreeSelectionModel
		 * TreePath getSelectionPath()
		 */

		// append node
		/* DefaultTreeModel
		 * void insertNodeInto(MutableTreeNode newChild,
           	 *	               MutableTreeNode parent, 
                 *                     int index)
                 */

	}

hi

--  ric
Technical Details
Message-ID: <375CED61.DF834903@cclinf.polito.it>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37530BEC.D264F8A@ns.sympatico.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,333519b2ee8e1626
X-Google-Attributes: gid111d45,public
From: Riccardo Scandariato <zion@cclinf.polito.it>
Subject: Re: JTree
Date: 1999/06/08
Message-ID: <375CED61.DF834903@cclinf.polito.it>
X-Deja-AN: 487013964
Content-Transfer-Encoding: 7bit
References: <37530BEC.D264F8A@ns.sympatico.ca>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing