[英]How to detect that a button is clicked inside a JFrame in java
I'm working on a little game in Java and I have a class that is extended JFrame and that is the interface of my game. 我正在用Java开发一个小游戏,我有一个扩展JFrame的类,它是游戏的接口。 I have an other class that instantiate my First class and it needs to when a button is clicked and which one.
我还有另一个类可以实例化我的第一堂课,它需要单击按钮时以及单击哪一个。 How do I do that?
我怎么做?
Check out EventListeners. 查看EventListeners。 They may help you https://docs.oracle.com/javase/tutorial/uiswing/events/intro.html
他们可能会帮助您https://docs.oracle.com/javase/tutorial/uiswing/events/intro.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.