views:

178

answers:

6

I am a newbie in Java. I am trying to figure out how to work this code. It seems to me that it would be very useful if in the beginning I get the general structure of the code (which methods exists and how they are interrelated). For example I see that "main" uses "createAndShowGUI" which, in its turn, uses "addComponentsToPane" and so on. So, the code has kind of a tree structure and it would be nice if I can visualize this structure. Is there any software that can do it. Or, more specifically, can NetBeans do it?

+1  A: 

In eclipse you can see it in ast view. Netbeans might have something similar.

fastcodejava
He wants to see iterated method calls, not the AST.
Michael Borgwardt
A: 

You can use the excellent doxygen source-code documentation generation tool for that.

JRL
A: 

I've some demo code here for an eclipse plugin. It creates a tree view and table view of instance variables and instance methods and how they relate to each other.

willcodejavaforfood
+2  A: 

Not sure about Netbeans, but in eclipse, you can right-click on a method and select "open call hierarchy" to get a tree view of methods that call the method you have selected, and at the top of the view is an icon to reverse this ("Show Callee Hierarchy"), which does pretty much what you want (except it shows only one method's callees at a time).

Michael Borgwardt
A: 

On Mac OS X, the Xcode design tool has a "Quick Model" feature that is specially handy for visualizing an existing class library. KeyEventDemo model

trashgod
A: 

Right clicking on a method name in NetBeans, you can choose Call Hierarchy. It'll open a window with a tree structure displayed. I think it defaults to the callers view. In the window's toolbar you can switch to the callees view. You will then have a navigable tree view of everything the current method calls. Expanding the tree on a callee will show that methods callees. It's not exactly a diagram but should help.

carlism