constructing Jtree with data from Database

balap
balap used Ask the Experts™
on
Hi
I am new to JTree and I need some help. My problem goes like this. I have a table in the data base which has data like Folder_Nr, Folder_Name, Folder_Prev_Nr, Folder_Typ_Nr, Folder_Access.

If the Folder_Nr is 1 and folder_prev_nr =0, then it is a root folder and if folder no is 3 and folder_prev_no is 1 then it is a sub folder of the Folder_Nr 1. and so on is the data. I need to present all these folders in a JTree and be able to dynamically add and delete folders.

It will be of great help if anyone can provide me with some lead or some source code.

Thanking u in advance
BalaaP
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I am trying to solve this problem for the past 5 hours and finally thoguht of getting some help from the great java community. So expecting there is someone out there ready to help me.
Commented:
There is a TreeModel that you populate

the JTree component will display the TreeModel according to any TreeCellRenderers that you define.

see these examples

http://www2.gol.com/users/tame/swing/examples/JTreeExamples1.html

Distinguished Expert 2018

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to randyd

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial