title: How to make a JButton do something
body: <p>I have my JButton set up and everything but it does absolutely nothing. Could someone tell me how to add a command such as system.out.println or some Scanner commands to a JButton? </p>
  
  <p>Here is my line of code. It is very simple and I'm just testing JButton to add it to some of my other programs</p>
  
  <pre><code>    import javax.swing.*;
  
      public class Swing extends JFrame {
      JButton load = new JButton("Load");
      JButton save = new JButton("Save");
      JButton unsubscribe = new JButton("Unsubscribe");
  
      public ButtonFrame() {
          super ("ButtonFrame");
          setSize(140, 170);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JPanel pane = new JPanel();
          pane.add(load);
          pane.add(save);
          pane.add(unsubscribe);
          add(pane);
          setVisible(true);
  }
  
      public static void main(String[] arguments) {
          ButtonFrame bf = new ButtonFrame();
      }
  }
  </code></pre>