This week's book giveaway is in the Raspberry Pi forum.
We're giving away four copies of Getting started with Java on the Raspberry Pi and have Frank DelPorte on-line!
See this thread for details.
Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

JTree

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Created a jtree .Now i need a method to find whether any element is there in the tree with name x.I want to know is any method is there like this.


Jtree.ischildNode(String name);


thanks
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I too need to do something like that..
how do I get this value and the index of it, so that I can add more children to it if it is equal to my value??

For example, I have a Vector with objects that have 3 values like
Vector(0) = Obj1 where Obj1(0)=C1, Obj1(1)=F1, Obj1(2)=S1
Vector(1) = Obj2 where Obj2(0)=C1, Obj2(1)=F1, Obj2(2)=S2
Vector(2) = Obj3 where Obj3(0)=C2, Obj3(1)=F2, Obj3(2)=S2
Vector(3) = Obj4 where Obj4(0)=C1, Obj4(1)=F2, Obj4(2)=S1

now how will I construct a tree from this? I'm trying a lot to get this working.. but somehow the constructed tree doesn't exactly match my requirement. Can somebody please help me..
the output tree I need is :
Root
-C1
_|-F1
____|-S1
____|-S2
_|-F2
____|-S1
-C2
_|-F2
____|-S2

and so on..
[ October 22, 2004: Message edited by: KathySmith SmithL ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ October 23, 2004: Message edited by: Craig Wood ]
 
KathySmith SmithL
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Craig Wood:



Thanks for the code Craig.. but u have hardcoded the values.. so it is easy to directly add the values.. but when I have dynamically input values, how do I do the same ?? I don't even know the order in which I'll get the values.. like C1 may first come and then C2 may come in the vector that contains the objects and then again I might get a C1-F1-S2 value.
[ October 23, 2004: Message edited by: KathySmith SmithL ]
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic