No. It has a parameter of ActionListener type. You cannot invoke .addActionListener(new Object());
. You can invoke:
button.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
// Stuff to do.
}
});
You should also really read the documentation for this.