How to display tree hierarchy in Java?

后端 未结 4 534
滥情空心
滥情空心 2021-01-05 02:15

I have a table in a database named \"Process\"

This process table has 3 fields:

  • process_id
  • process_name
  • process_parent_id
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-05 02:35

    Swing has a built-in control for displaying data in a Tree format called JTree. It also provides a data model called DefaultTreeModel which you can use to store the data. This link gives a pretty good explanation of using a JTree with a data model.

    [Edit]:

    To answer your updated question, a graph like that could quite well be handled by JGraph which would also provide the data model which seems to work similarly to the Tree model swing provides.

提交回复
热议问题