title: Simple Java Graphic Program Not Displaying
body: <p>Basically i'm starting to learn graphics in java so I made a simple program to display two rectangles and a string on the screen. The program compiles fine but does not display the two rectangles or the string. Any input on my problem would be greatly appreciated.</p>
  
  <pre><code>//ClassOne.java
  import javax.swing.*;
  
  public class ClassOne {
      public static void main(String[] args)
      {
          JFrame f = new JFrame("Title");
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          ClassTwo object = new ClassTwo();
  
          f.add(object); //add object to frame
          f.setSize(400,250);
          f.setVisible(true);
  
      }
  }
  
  
  //ClassTwo.java
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  public class ClassTwo extends JPanel {
  
      public void paintComponet(Graphics g) //takes an object from a graphics class
      {
          super.paintComponent(g);
          this.setBackground(Color.BLACK);
  
          g.setColor(Color.WHITE);
          g.fillRect(25, 25, 100, 30); //x,y,width, height
  
          g.setColor(new Color(190,81,215));
          g.fillRect(25, 70, 100, 30);
  
          g.setColor(Color.RED);
          g.drawString("Text", 25, 120);
          System.out.print("hi");
      }
  
  }
  </code></pre>