Il "tasto" è un JButton?
Aggiungi un ActionListener dando un corpo al metodo actionPerformed.

http://docs.oracle.com/javase/tutori...nlistener.html