To add an ActionListener to a JButton (or other component with an addActionListener method), the must add an object that implements the ActionListener interface. I recommend reading the following: ...