package test; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class Test { public static void main (String args[]) { Test t = new Test(); JButton b = new JButton (); b.addActionListener (t.new ButtonHandler()); } private void a () {} class ButtonHandler implements ActionListener{ public void actionPerformed (ActionEvent arg0) { a(); } } }