title: JButtons not appearing on my JFrame
body: <p>I am making a program that includes a GUI. For some reason, the <code>JButton</code> objects that I have created are not showing up onto my <code>JFrame</code> when I run the program. Here is the code:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  public class ReverseAStringMain extends JPanel {
  private JButton enterButton, exitButton;
  private JTextField textField;
  private JPanel buttonPanel;
  private JTextArea textArea;
  
  
  public ReverseAStringMain(){
      JButton enterButton = new JButton("Enter");
      JButton exitButton = new JButton("Exit");
      enterButton.setPreferredSize(new Dimension(60,60));
      exitButton.setPreferredSize(new Dimension(60,60));
  
      ButtonListener listener = new ButtonListener();
      enterButton.addActionListener(listener);
      exitButton.addActionListener(listener);
  
      buttonPanel = new JPanel();
      buttonPanel.setPreferredSize(new Dimension(200,50));
      buttonPanel.setBackground(Color.black);
      buttonPanel.add(enterButton);
      buttonPanel.add(exitButton);
  
  
      textField = new JTextField();
      textField.setSize(200, 100);
  
      textArea = new JTextArea();
      textArea.add(textField);
  
  
      add(buttonPanel);
      add(textField);
  
  }
  
  //Creating a ButtonListener class that implements the ActionListener interface
  private class ButtonListener implements ActionListener{
          @Override
          //Overriding the ActionPerformed method of ActionListener
          public void actionPerformed(ActionEvent action) {
              if(action.getSource()== enterButton)
                  enterButton();
              if(action.getSource()== exitButton)
                  System.exit(0);
          }
  }       
  
  private void enterButton() {
              // TODO Auto-generated method stub
  
  }
  
  
  public static void main (String[] args){
      JFrame frame = new JFrame("Raj's Reverse a String Program");
      frame.setBackground(Color.white);
      frame.setVisible(true);
      frame.setResizable(false);
      frame.setLocationRelativeTo(null);
      frame.setSize(new Dimension(600,600));
      //frame.pack();
      frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
      frame.getContentPane().add(new ReverseAStringMain());
  
  
  
  }
  
  }
  </code></pre>
  
  <p>If there are any problems or improvements I can make in my code, please let me know!</p>