Help with ActionListener please

Thread Starter


Joined May 25, 2010
Hey guys, I need help.

I'm using Java and I'm working on three classes (Main, class2 and class3). I'm using ActionListener from "class3" to call "class2" when a button is clicked. I don't know what to put in the actionlistener body so I can achieve that.

class2.addActionListener(new Action1());

public static class Action1 implements ActionListener{
public void actionPerformed(ActionEvent e) {



Can anybody help me out? I've tried different things but none of them have worked, Do I have to do anything in the main class to make it work? thanks.


Joined Sep 20, 2005
what do you mean by "call class2"? Do you mean create an instance of it, or call some method in some instance or...?