permaculture playing cards
The moose likes Beginning Java and the fly likes Visualizing container hierarchy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Visualizing container hierarchy" Watch "Visualizing container hierarchy" New topic

Visualizing container hierarchy

John Eagle

Joined: Apr 27, 2010
Posts: 1

I am looking for a way to visualize (or at least store in some vector of sorts) the container hierarchy of a java app I have created. Ideally I would like the result to include all levels of containment, i.e. the entire tree of such relationships.

The problem is that the classes I am referring to are self-made and to not extend any standard Java classes. The problem is that my classes are entirely self-made and do not extend any standard Java classes. Such tools as Vector and Container classes (which are part of AWT) are not available to my own classes.

Is there a (semi-) automatic way to generate this hierarchy? One example may be found at but it assumes that classes are based on AWT.

Many thanks!
Jonas Isberg
Ranch Hand

Joined: Mar 18, 2003
Posts: 118
If I had your trouble I would consider using reflection. There is a tutorial that could get you started.
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

And welcome to JavaRanch!!

When you do things right, people won't be sure you've done anything at all.
It is sorta covered in the JavaRanch Style Guide.
subject: Visualizing container hierarchy
jQuery in Action, 3rd edition