In Java Swing, whenever you want to have components react to a click event on a button, you need to attach those components to an ActionListener, then pass the ActionListener object. Learn how to do all that right here.
S01E27 · Java Swing: Create a Simple User Interface
S01E29 · Java Swing: BorderLayout