title: Java gui does not print after action listeners listens to event
body: <p>Code does not output the "Works" message in the ide text field. How can I make it so the program outputs in the ide's text my message? Thank you.</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class test extends JFrame {
  
      private JButton button1;
  
      public test() {
          JFrame frame = new JFrame("Test Program");
          JPanel panel = new JPanel();
          JButton button1 = new JButton("Click me PLEASE!");
          panel.setBackground(Color.red);
          panel.add(button1);
          frame.getContentPane().add(panel);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);
          frame.setSize(800, 800);
          Listener1 listen = new Listener1();
          button1.addActionListener(listen);
  
      }
  
      public static void main(String[] args) {
          new test();
      }
  
      private class Listener1 implements ActionListener {
  
          public void actionPerformed(ActionEvent event) {
              if (event.getSource() == button1) {
                  System.out.println("Works!");
              }
          }
      }
  </code></pre>