Article View: borland.public.jbuilder.java.swing
Article #13237Adding nodes to a tree
From: ssridhar
Date: Mon, 24 Aug 1998 00:00
Date: Mon, 24 Aug 1998 00:00
28 lines
1497 bytes
1497 bytes
Hi all,
Question 1:
I'm trying to add new nodes to the tree. First I used
parentnode.add(childNode) method which had refreshing problems.
So I'm trying to use a method available with DefaultTreeModel
model.insertNodeInto(parentNode,childNode,index)
I can give the parent and child nodes and I'm having difficulty in
computing the index at which the child is to be inserted.
For inserting a node which is a direct child of the root.I used
index = parentNode.getFirstChild().getSiblingCount();
It works okay until I add a child to this node(which is a grandChild of
the root). After which the getSiblingCount() returns bizarre
values.
Anybody has ideas of implementing this or any other method.
2. Any ideas of how to Expand all the nodes of the tree irrespective
of which node is currently selected
Thanks in advance
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Technical Details
Message-ID:
<6rrtr7$r2r$1@nnrp1.dejanews.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,4e4da76d04aaa0cd,start X-Google-Attributes: gid111d45,public From: ssridhar@salesvision.com Subject: Adding nodes to a tree Date: 1998/08/24 Message-ID: <6rrtr7$r2r$1@nnrp1.dejanews.com> X-Deja-AN: 384184281 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Aug 24 14:37:26 1998 GMT Newsgroups: borland.public.jbuilder.java.swing X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; I)