button.addActionListener(new ActionListener() { //interfata implementata e ActionListener public void actionPerformed(ActionEvent e) { numClicks++; } });