How to add a panel class to my frame in main class
<p>I am fairly new to oo, I have created a class which is most of the interface of my program, I have put it all together in a class. I then want to add my Panel class to my main class so my panels are attached to my Frame: </p>

<p>This is what I have tried, I am not receiving any errors, when I run my program but the panels are not displaying:</p>

<p><strong>Panel Class:</strong></p>

<pre><code>  public class PanelDriver extends JPanel {
       public JPanel p1, myg;
       public PanelDriver() {

       JPanel p1 = new JPanel();
       p1.setBackground(Color.CYAN);

      // Graphicsa myg = new Graphicsa();


    JTextArea txt = new JTextArea(5,20);
    txt.setText("test");
    p1.add(txt);

   }
}
</code></pre>

<p><strong>Main class:</strong></p>

<pre><code>public class GraphicMain {

    public static void main(String[] args) {
    JFrame frame = new JFrame("My Program");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(600, 600);

    PanelDriver panels = new PanelDriver();
    frame.getContentPane().add(panels);

    GridLayout layout = new GridLayout(1,2);
}
</code></pre>