title: How to add a button to a JFrame Gui
body: <p>I'm trying to add a button to a frame gui.<br>
  i tried making a panel and adding it to that, but it does not work.
  please help!</p>
  
  <p>here is my code:</p>
  
  <pre><code>import javax.swing.*;
  
  public class Agui extends JFrame {
      public Agui() {
          setTitle("My Gui");
          setSize(400, 400);
          setVisible(true);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
  
          JButton button;
          JPanel panel;
  
          // my error lines are under the "panel" and  "button"
          // it says i must implement the variables. what does that mean???
          panel.add(button);
      }
      public static void main(String[] args) {
          Agui a = new Agui();
      }
  }
  </code></pre>