Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31274
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JTree add / remove nodes |
| Date | Thu, 05 Mar 2015 14:18:21 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 32 |
| Message-ID | <mdaa4l$ji1$1@dont-email.me> (permalink) |
| References | <md8vkk$2905$1@ariadne.rz.tu-clausthal.de> <md9ogk$6lv$1@dont-email.me> <mda6v0$2hdn$1@ariadne.rz.tu-clausthal.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Thu, 5 Mar 2015 19:17:41 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="20033"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lDH7txfvddaNV4Uz5Eom0" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
| In-Reply-To | <mda6v0$2hdn$1@ariadne.rz.tu-clausthal.de> |
| Cancel-Lock | sha1:Hi+tsfJf6CUTnD2ZYY3Eg91i+S8= |
| Xref | csiph.com comp.lang.java.programmer:31274 |
Show key headers only | View raw
On 3/5/2015 1:23 PM, Philipp Kraus wrote:
> On 2015-03-05 14:17:28 +0000, Jeff Higgins said:
>
>> On 03/05/2015 02:12 AM, Philipp Kraus wrote:
>>> I have got a tree dataset and I would like to visualize the data with a
>>> JTree component. The user should only brows in the tree, so no
>>> modifcation on the nodes is needed.
>>
>> JTree.DynamicUtilTreeNode has a static
>> createChildren(DefaultMutableTreeNode parent, Object children)
>> method which is convenient for this.
>
> Greate thanks, this work's.
>
> My question is, the createChildren adds only nodes until the parent,
> but how can I add a full path similar to the linux command "mkdir -p"
> which creates all directories of the path, if it not exists.
Divide the components of your path into parent, child, grandchild,
and so on. If the parent is not already present in the tree's top
level, add it. Then if the child is not already present in the
parent's level, add it. Then if the grandchild is not already present
in the child's level, add it ...
See
https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JTree add / remove nodes Philipp Kraus <philipp.kraus@flashpixx.de> - 2015-03-05 08:12 +0100
Re: JTree add / remove nodes Jeff Higgins <jeff@invalid.invalid> - 2015-03-05 09:17 -0500
Re: JTree add / remove nodes Philipp Kraus <philipp.kraus@flashpixx.de> - 2015-03-05 19:23 +0100
Re: JTree add / remove nodes Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-03-05 14:18 -0500
Re: JTree add / remove nodes Philipp Kraus <philipp.kraus@flashpixx.de> - 2015-03-05 23:59 +0100
Re: JTree add / remove nodes Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-03-05 18:28 -0500
csiph-web