views:

41

answers:

1

I have this table:

CREATE TABLE perarea ( id_area INT primary key, nombre VARCHAR2(200), id_areapadre INT references perarea(id_area) );

And this was added to access the data:

alt text

My intention is to create a heirarchy showing areas and their subordinates in the treeview. Then when a user clicks a node, have a table on the right of the treetable load all employee from that area.

First thing's first though, how can I populate the treetable?

Thank you!

A: 

It's helpful to think of a JTree as a view of the underlying TreeModel. An example implementation of TreeModel, intended for use with org.netbeans.swing.outline.Outline, illustrates a hierarchical FileTreeModel that may guide you. As you are using Oracle, you may find the article Querying Hierarchical Data with CONNECT BY helpful, too.

Addendum: The article Understanding the TreeModel may be helpful, too.

trashgod