How can I use a treetable to show all rows in an Oracle SQL table?

放肆的年华 提交于 2019-12-24 00:48:36

问题


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:

My intention is to create a hierarchy 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!


回答1:


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 Dynamic JTree from database query helpful, too.

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

Addendum: See also this related example that uses FileTreeModel.



来源:https://stackoverflow.com/questions/3151493/how-can-i-use-a-treetable-to-show-all-rows-in-an-oracle-sql-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!