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 2 of 2

Thread: How to create jtree which takes data from database in swing??

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

    Question How to create jtree which takes data from database in swing??

    Hello
    I have a database table called Rubric which has records around 40,0000. This table has two column id and parent id like parent child relationship.
    I have to create a JTree using this table. example of rows :-

    ID parentID
    0 Blankl (Name Parent)
    1 0
    2 0
    3 1
    4 1
    5 3
    6 4.... onwards....

    When I fetch the data from table and create tree It takes very very long time around 4 to 10 min which can't be accepted.
    Please Advise me which approach should I follow.

    Thank you..


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,297
    Thanks
    180
    Thanked 824 Times in 767 Posts
    Blog Entries
    5

    Default Re: How to create jtree which takes data from database in swing??

    Load your data lazily. Briefly, only load what needs to be loaded. Once a user expands a node, you then load its children. The following tutorial has a section on how to do this
    How to Use Trees (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

Similar Threads

  1. Java Bar graph takes user input to create graph?
    By kenjiro310 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 31st, 2011, 07:37 AM
  2. How to Use JTree to create a File System Viewer Tree
    By JavaPF in forum Java Swing Tutorials
    Replies: 0
    Last Post: March 15th, 2011, 05:05 AM
  3. How to Use JTree to create a File System Viewer Tree
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 0
    Last Post: March 15th, 2011, 05:05 AM
  4. To Create and Admin an database
    By JavaNoob89 in forum Object Oriented Programming
    Replies: 2
    Last Post: December 10th, 2010, 09:15 AM
  5. Replies: 0
    Last Post: April 15th, 2010, 05:13 AM