title: Consistently make a button visible on JFrame
body: <p>My program complies and displays a blank frame. I have tried  multiple ways, but I am thinking this should work, I don't understand why  it doesn't?<br>
  The code is simple it just shows a blank box and a button that informs the user the action Listener is working. </p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class Udemy {
  
    public Udemy() {
      JFrame f = new JFrame();
      f.setTitle("La's Frame");
      f.setSize(400,400);
      f.setVisible(true);
      f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
  
      JPanel panel = new JPanel();
      f.getContentPane().add(panel);
  
      JButton b1 = new JButton("Click me");
      panel.add(b1);
      b1.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
          System.out.println("Action Listener is working");
        }
      });
    }
  
    public static void main(String[] args){
      Udemy ud = new Udemy();
    }
  }
  </code></pre>