How to display a tree of objects in a JTree?

Posted by paul on Stack Overflow See other posts from Stack Overflow or by paul
Published on 2010-05-05T10:19:20Z Indexed on 2010/05/05 21:58 UTC
Read the original article Hit count: 201

Filed under:
|
|

Imagine a collection of objects such as World, Country, Region and City. World contains a list of Country objects, Country contains a list of Region objects etc.

I would like to represent this structure in a JTree and be able to add, remove and move objects around the tree.

Can I easily create a TableModel from this structure? World would be the root object and I would need to perform some object-specific rendering.

Any one know of an appropriate tutorial?

© Stack Overflow or respective owner

Related posts about swing

Related posts about jtree