Java: addActionListener to Jbutton problem

view story

http://ubuntuforums.org – Hi, I'm new of Java and I have a trouble with Jbutton. I learned that I can add an addActionListener to Jbutton as follow: Code: Jbutton Button1 = new Jbutton("1"); Button1.addActionListener(new ActionListener() {                 public void actionPerformed(ActionEvent arg0) { } } The Jbutton is contained inside a Jdialog together with other Jlabels and Jlist, the code is standard. In the code, I call a function that contains the Jbutton listener. The first time that the function is called, when the Jbutton is activated is executed the c (Hardware)