Roman
Roman

Reputation: 131038

Is it possible to display of the tree structure of the Java-code?

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?

Upvotes: 7

Views: 4265

Answers (7)

trashgod
trashgod

Reputation: 205785

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

Upvotes: 1

JRL
JRL

Reputation: 77995

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

Upvotes: 0

Partharaj Deb
Partharaj Deb

Reputation: 904

In NetBeans open Window > Navigator. You'll get it as shown in the image-

enter image description here

Upvotes: 1

carlism
carlism

Reputation: 158

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.

Upvotes: 5

Michael Borgwardt
Michael Borgwardt

Reputation: 346260

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).

Upvotes: 4

willcodejavaforfood
willcodejavaforfood

Reputation: 44063

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.

Upvotes: 0

fastcodejava
fastcodejava

Reputation: 41087

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

Upvotes: 1

Related Questions