Article View: borland.public.jbuilder.java.swing
Article #9765Re: bind data to treenode in treeControl?
From: hot_bee
Date: Mon, 24 Jan 2000 00:00
Date: Mon, 24 Jan 2000 00:00
70 lines
3342 bytes
3342 bytes
Dear friend
Thank you so much for your help, although I think that maybe I didn't
express the question I met clearly. So here I present my requiremant again.
wish you can help me, thank you in advance!
I want to insert some nodes to the treeControl which have a readable label:
for example, a tree like this:
Books-
|
|--Art-
| |--Clssified
| |--Modern
|
|--Culture-
| |--War
| | |--The Memory in World War II
| | |--The Memory in World War I
| |
| |--Love
| |--The Love theme
| |--The Romance of a richer
|
|--Living
for example, I can insert a book named "Love story" to the node "Love", and
It will show on the tree below the leave "The Romance of a richer" with the
label "Love story", and when I choose the node "love story", the associated
informatin(author name, publishing house, price etc) of the book "Love
story" will fill into some textboxes left side the tree.
This is what I mean last time: "binding the data to node, and at the same
time keep the lable of each node readable". the way you recommend is to use
method addchild(parent,anObject), which will add a node which show a string
like this "borland.samples.jbcl.treecontrol.NodeInfo@1ced1f", so this is not
I want, I need it shows "Love story".
So I wish my node has some associated information and a readable label. Now
my implementation uses a 2-dimension matrix class:
bmc= new BasicMatrixContainer(0,2);
each row of matrix have two columns, one is the lable of node, the other is
the instance of class MyNode which has information of this book. when insert
a node to treeControl, use line like this:
treeControl.addchild(LoveNode, "Love story");
When choose the node labeled "Love story", first get the label of the node,
then find the row in matrix the value of first column is "Love story",
third, got the column info's value (it is a instance of class MyNode) of
this row, then all the information can be retrived from this instance.
But I don't think it is the best way to fulfill my wish, cause in most case,
there are requirement like my program, so I think it reasonable to meet all
what I want in a single TreeControl instead of doing so many things outside
the control, isn't it? or there are still better way to go, so I wish you
can give me some advice about it.
BTW, I wonder how to distribute my program? I wish I can run the program
separately(for example in command line status or in www browser like
Netscape Navigator) insead of just running it in JBuilder IDE. How to config
the environment?
Thank you so much again for your help last time!
best wishes to you
hotbee
Technical Details
Message-ID:
<86h5rd$me313@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<868cm5$i1q1@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,61054c27f3bb1dc9 X-Google-Attributes: gid111d45,public From: "hot_bee" <hot_bee@188.net> Subject: Re: bind data to treenode in treeControl? Date: 2000/01/24 Message-ID: <86h5rd$me313@bornews.borland.com> X-Deja-AN: 576839487 References: <868cm5$i1q1@bornews.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing