首页 > 解决方案 > 在代码中调用 ActionListener 的 actionPerformed() 的地方

问题描述

这是处理按钮单击的代码:

   JButton button = new JButton();
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
             // handle the button click
        }
    });

我知道actionPerfomed当用户单击按钮时会调用它。但是在 Java 源代码库中哪里可以找到调用呢?所有的魔法发生在哪里?

标签: javaswinganonymous-class

解决方案


推荐阅读