Re: How to write narray Tree? example pls



sanny.h@xxxxxxxxx wrote:
Hi all,
       Thank you all for having this group.
        I am new to the world of java.
        I want to write a java program were the strings are stored in a
tree (not binary tree).
For example
1) "APPLE" -> "RED"
2) "APPLE" -> "WHITE"
3) "APPLE" -> "USA" ->"RED"
4)"APPLE" -> "USA" -> "WHITE"
5) "APPLE" -> "USA" -> "NYC" -> "RED" ............soon

So APPLE will have 3 child nodes (RED,WHITE,USA). Child node USA will
have 3 child nodes (RED,WHITE,NYC) , NYC has RED ......soon.

If not tree any other method that i can achieve this?

Thanks in advance.
sanny.

I guess by tree you mean a visual tree. Say a SWING JTree or AWT Tree.

I can point you to samples that will get you going. Not sure what docs you are using but first hear are the important ones you will need to learn from.

Current 1.5 Docs
http://java.sun.com/j2se/1.5.0/docs/

Current 1.5 APIs
http://java.sun.com/j2se/1.5.0/docs/

The Java Language Specification, Third Edition
http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html

The Really Big Index, A list of all content pages in the The JavaTM Tutorial
http://java.sun.com/docs/books/tutorial/reallybigindex.html


The Java Developers Almanac 1.4
http://javaalmanac.com/

For samples of JTree look here..
http://javaalmanac.com/cgi-bin/search/find.pl?words=JTree

Also I have more references at my website.
http://weconsultants.servebeer.com/JHackerAppManager/Portal?xpc=1$@4$@1$@19

A good reference is at Roedy Greens web site.
http://mindprod.com/jgloss/jgloss.html
http://mindprod.com/jgloss/jtree.html




--


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________


'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
.



Relevant Pages

  • Re: How do I use Comparators?
    ... I am writing a red-black tree class. ... > I will just say I am taking this course, learning Java as I go. ... > methods work. ... IBM Australia - Tivoli Security Software ...
    (comp.lang.java.help)
  • Re: Java Newbie challenge
    ... The java built in structures are, for example, all of the collection ... store a tree in RAM. ... You could use objects with a mother and father parent pointer. ...
    (comp.lang.java.help)
  • Re: Java and Large Applications
    ... > I just spent the morning fixing my umpteenth "memory leak" in a large ... > tree root to null. ... > I considered the idea of rewriting my Java app in C. ... it clearly states that setting pointers to null to ...
    (comp.lang.java.programmer)
  • Java and Large Applications
    ... I just spent the morning fixing my umpteenth "memory leak" in a large ... tree root to null. ... I considered the idea of rewriting my Java app in C. ... So much for garbage collection. ...
    (comp.lang.java.programmer)
  • Re: JTree control
    ... I'm a C/C++ programmer, I work on Java by 1 month and I'm really happy with Java! ... I'm using the Swing's JTree control; I create a JTree on a panel and I add some nodes and at the end the leaf. ... node without notifying the tree using one of the appropriate methods in the tree model. ...
    (comp.lang.java.gui)