//complement your code
private static int i = 0;
JButton btnInput = null;
btnInput = new JButton("Beat me");
JTextField text = new JTextField();
btnInput.addActionListener(new ActionListener(){
i++;
public void actionPerformed(ActionEvent e) {
if ( e.getSoruce() == btnInput )
text.setTest(new Integer(i).toString());
else
//...your other code
}
};)