title: Java GUI: How to add several classes to "Frame" class
body: <p>I am a complete beginner at Java coding and I have never worked with GUI before. Here's what I am trying to do. I have main class "Frame" and two classes: "Circle" and "Square". How do I add Circle and Square to Frame that they'll appear on the frame?</p>
  
  <p>Sorry for this easy question but I need your help on this.
  Thanks in advance!</p>
  
  <pre><code>public class Frame extends JFrame{
  
      public static void main(String[] args) {
          Frame f = new Frame();
          Circle circle  = new Circle();
          Square square  = new Square();
          f.add(circle);
          f.add(square);
      }
  
      public Frame(){
          setTitle("Frame");
          setSize(500, 500);
          setVisible(true);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
      }
  }
  
  
  
  public class Circle extends JFrame{
  
      public Circle(){
      }
  
      public void paint(Graphics g){
          g.setColor(Color.GREEN);
          g.drawOval(300, 300, 200, 200);
      }
  }
  
  
  public class Square extends JFrame{
  
      public Square(){
      }
  
      public void paint(Graphics g){
          g.setColor(Color.GREEN);
          g.drawRect(300, 300, 500, 500);
     }
  }
  </code></pre>