Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: efficient way to build Tree gui

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default efficient way to build Tree gui

    Hello,
    I would like to know what is the best way to populate a tree gui which has the following details:
    My application should reflect a tree structre with about 8000 members but directly under the
    root there are maximum 15 members.Its clear that each time a user open the application he wont need to look at all the 8000 members and my question is how to build the tree ? should I load all members and build the tree or load just the first level and only if a user expand a member ,its children should be loaded ? and if the second way is better ,how should I know if
    the members were already loaded ?
    The second issue is how to do it (if there is any difference) : my application can get the members details by quering some sql tables (the member details actually handled by another application and are in some tables) or getting the info into the stack by using this other application api.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,337
    Thanks
    182
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: efficient way to build Tree gui

    By tree, I assume you mean JTree. Did you read the following? It contains details on how to do what you wish:
    How to Use Trees (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: efficient way to build Tree gui

    thanks for the link ,I will read and follow it with my program. I hope it will help since I didnt ask ow to build a tree with about 15 members like in the example but how to build it with 8000 members as written in the question so if you have please send me a code example or a link which describe the way to do it

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,130
    Thanks
    52
    Thanked 2,286 Times in 2,257 Posts

    Default Re: efficient way to build Tree gui

    Cross posted at Tree gui builder - Java

  5. #5
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: efficient way to build Tree gui

    Norm ,your reply goal isnt clear : Did you answer the question (NO) , or you just wanted to disturb ? what is
    the additional value of what you sent ? the above question was asked also in another forum ,so what? isnt it
    accaptable to ask some people the same question ? when you try to find out something do you limit yourself
    just to 1 site and dont ask yourself if there are other sites ? I hope that other people who read this forum will
    answer the question and wont be affected by your bad attitude.Next time if you dont have something clever to
    write , its better that you stay quite.

  6. #6
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: efficient way to build Tree gui

    The problems with cross-posting

    Norm is tying up your cross-posts in the way that you *should be* if you were to adhere to reasonably well-known forum etiquette. He is doing all of us - including you - a favour.

  7. #7
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: efficient way to build Tree gui

    I read your remark, and I hope that Norm had the same clear thought since as he didnt add anything to the
    copied link in both forums ,it could be understanded as :"People, dont answer this question.It was already
    asked in other place" and the worst thing is that he wrote it also in the other forum , so to avoid it lets agree that if someone has answer the original question it will be nice if he will send it since i still didnt get a full answer to that question

  8. #8
    Junior Member
    Join Date
    Aug 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: efficient way to build Tree gui

    anybody got something new ?

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,130
    Thanks
    52
    Thanked 2,286 Times in 2,257 Posts

    Default Re: efficient way to build Tree gui

    The TreeDemo example can easily be changed to handle thousands of elements in a JTree

Similar Threads

  1. efficient way of checking duplicates
    By starmandell in forum Algorithms & Recursion
    Replies: 2
    Last Post: February 2nd, 2011, 05:52 PM
  2. What is the fastest and most efficient for 3 dimensional structures?
    By aussiemcgr in forum Collections and Generics
    Replies: 10
    Last Post: December 11th, 2010, 06:50 PM
  3. Having trouble understanding what teacher said for build Tree.
    By javapenguin in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 16th, 2010, 07:22 PM
  4. Data Structures(Binary Search Tree to AVL Tree)ASAP
    By jfAdik in forum Algorithms & Recursion
    Replies: 2
    Last Post: April 5th, 2010, 03:58 AM
  5. Replies: 1
    Last Post: March 28th, 2009, 07:21 AM