How to create jtree which takes data from database in swing??
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 :-
0 Blankl (Name Parent)
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.
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)