简体   繁体   English

制作ActionListener时遇到麻烦

[英]Having trouble making a ActionListener

I try to make an ActionListener , and it gives me a error. 我尝试制作一个ActionListener ,这给了我一个错误。 I have events imported, and it still doesn't work. 我已导入事件,但仍然无法正常工作。 Here is my code: 这是我的代码:

send.addActionListener(new jj);

private class jj implements ActionListener
    {
        public void actionPerformed (ActionEvent event)
        {
        }
    }

It gives the 'new jj' a error, and by the class and method, it gives actionListener, and ActionEvent a error. 它给'new jj'一个错误,并且通过类和方法,给actionListener和ActionEvent一个错误。

I need basic help in how to make a actionListener. 我需要有关如何制作actionListener的基本帮助。

It appears that you are missing a () after your new jj . 看来您在new jj之后缺少() Also and this is more of a style point your class names are better capitalized (and a little more descriptive) 而且,这更像是样式名称,您的班级名称大写(且更具描述性)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM