title: problem with super.paintComponent(g)
body: <p>This is the snippet :</p>
  
  <pre><code>protected void paintComponent(final Graphics g) {
  
   Runnable r=new Runnable() {
  
   @Override
  
    public void run() {
     while(true) {
       super.paintComponent(g);  // &lt;----- line of error
       g.setColor(Color.red);
       g.drawOval(x,y,width,height);
       g.fillOval(x,y,width,height);
       x++;
       y++;
       width++;
       height++;
         if(width==20)
            break;
       try {
          Thread.sleep(100);
       } catch(Exception exc) {
           System.out.println(exc);
         }
     }
    }
  };
   Thread moveIt=new Thread(r);
   moveIt.start();
  }
  </code></pre>
  
  <p>The following error is produced when i compile the complete code :</p>
  
  <pre><code>d:\UnderTest&gt;javac mainClass.java
  mainClass.java:18: cannot find symbol
       super.paintComponent(g);
            ^
  symbol:   method paintComponent(Graphics)
  location: class Object
  1 error
  </code></pre>
  
  <h2><strong>Why do i get this error?</strong></h2>
  
  <p><em>In case this is my complete code :</em></p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.lang.Thread;
  
  class movingObjects extends JPanel {
  int x=2,y=2,width=10,height=10;
  
  @Override
  
  protected void paintComponent(final Graphics g) {
  
  Runnable r=new Runnable() {
  
   @Override
  
    public void run() {
     while(true) {
       super.paintComponent(g);
       g.setColor(Color.red);
       g.drawOval(x,y,width,height);
       g.fillOval(x,y,width,height);
       x++;
       y++;
       width++;
       height++;
         if(width==20)
            break;
       try {
          Thread.sleep(100);
       } catch(Exception exc) {
           System.out.println(exc);
         }
     }
    }
   };
     Thread moveIt=new Thread(r);
      moveIt.start();
      }
     }
  
  class mainClass {
  
   mainClass() {
   buildGUI();
  }
  
   public void buildGUI() {
   JFrame fr=new JFrame("Moving Objects");
   movingObjects mO=new movingObjects();
   fr.add(mO);
   fr.setVisible(true);
   fr.setSize(400,400); 
   fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  
   public static void main(String args[]) {
    new mainClass();
    }
   }  
  </code></pre>