简体   繁体   English

在Eclipse中测试Java GUI时,我怎么知道调用哪个方法/类?

[英]How do I know which method/class is called when I test java GUI in eclipse?

I am a beginner using eclipse for java programming. 我是使用eclipse进行Java编程的初学者。 Recently I downloaded certain source code online and ran it in eclipse successfully. 最近,我在线下载了某些源代码,并在eclipse中成功运行了它。 I want to learn how it runs. 我想学习它的运行方式。 However, I failed to find a way to monitor the progress during the program running. 但是,我找不到能在程序运行期间监视进度的方法。 For example, if I run the application and click certain button in the application GUI, how do I know which class/method is called? 例如,如果我运行该应用程序并单击应用程序GUI中的某些按钮,我如何知道调用了哪个类/方法? In other words, how can I use eclipse to monitor the process of program running? 换句话说,如何使用eclipse监视程序运行过程?

The general answer is to use the debugger. 一般的答案是使用调试器。 For example, set a breakpoint in some method and then use "Debug As" instead of "Run As" to run the application within Eclipse. 例如,以某种方法设置断点,然后使用“调试方式”代替“运行方式”在Eclipse中运行应用程序。

Here are a couple of tutorials / articles on using the Eclipse Debugger. 这是有关使用Eclipse Debugger的一些教程/文章。

在要调试的方法上放置一个断点(双击该行的左侧),然后调试程序。

只需将断点放在需要在Debug模式下查看和运行应用程序的代码行中,然后它将在您需要检查的相关代码行中等待。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎么知道哪个线程称为我的Log方法? - How do I know which Thread called my Log method? 我怎么知道哪个类称为抽象方法? - How do I know what class called the abstract method? 我们如何知道哪个方法(java.class)调用了当前方法 - how do we know which method (java.class) has called the current one 在我的新GUI中调用run方法后,如何返回课程? - How do I return to the class after I've called my run method in my new GUI? 我如何知道一个类在Java中是否有方法以及如何调用它 - How do I know if a class has a method in java and how do I invoke it 当我不知道是数据库项的主键的随机ID时如何测试方法 - How to test a method when I don't know random id which is primaryKey of database item 如何测试在构造函数中也调用该方法的类的方法? (JUnit的) - How do I test methods of classes in which the method is also called in the constructor? (JUnit) 我如何知道何时可以从后台线程安全地调用方法? - How do I know when a method can be called safely from a background thread? 在GUI中调用actionPerformed时如何调用方法 - How do I call methods when actionPerformed is called in GUI Java:如何根据类名知道要使用哪个jar文件? - Java: How do I know which jar file to use given a class name?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM