是否可以显示Java代码的树形结构?

发布于 2024-08-19 14:48:30 字数 27 浏览 3 评论 0原文

我是Java新手。我试图弄清楚如何工作

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

天赋异禀 2024-08-26 14:48:30

右键单击 NetBeans 中的方法名称,您可以选择调用层次结构。它将打开一个显示树结构的窗口。我认为它默认为调用者视图。在窗口的工具栏中,您可以切换到被调用者视图。然后,您将获得当前方法调用的所有内容的可导航树视图。展开被调用者上的树将显示被调用者的方法。它不完全是一个图表,但应该有所帮助。

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.

安静 2024-08-26 14:48:30

不确定 Netbeans,但在 Eclipse 中,您可以右键单击一个方法并选择“打开调用层次结构”以获取调用您所选方法的方法的树视图,并且在视图的顶部有一个图标反转这个(“显示被调用者层次结构”),它几乎可以完成你想要的事情(除了它一次只显示一个方法的被调用者)。

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

把人绕傻吧 2024-08-26 14:48:30

eclipse 中,您可以在 最后视图。 Netbeans 可能有类似的东西。

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

笑饮青盏花 2024-08-26 14:48:30

NetBeans 中打开 Window >导航器
您将得到如图所示的结果 -

在此处输入图像描述

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

enter image description here

小…楫夜泊 2024-08-26 14:48:30

在 Mac OS X 上,Xcode 设计工具具有“快速模型”功能,对于可视化现有类特别方便图书馆。
KeyEventDemo 模型

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

清君侧 2024-08-26 14:48:30

我有一些 Eclipse 插件的演示代码这里。它创建实例变量和实例方法以及它们如何相互关联的树视图和表视图。

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.

只是在用心讲痛 2024-08-26 14:48:30

您可以使用优秀的 doxygen 源代码文档生成工具。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文