title: how is paint() running without being called in the main method?
body: <p>This is a beginner question for java graphics using the awt package. I found this code on the web to draw some simple graphics.</p>
  
  <pre><code>import java.awt.*;
  public class SimpleGraphics extends Canvas{
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          SimpleGraphics c = new SimpleGraphics();
          c.setBackground(Color.white);
          c.setSize(250, 250);
  
          Frame f = new Frame();
          f.add(c); 
          f.setLayout(new FlowLayout()); 
          f.setSize(350,350);
          f.setVisible(true);
      }
      public void paint(Graphics g){
          g.setColor(Color.blue);
          g.drawLine(30, 30, 80, 80);
          g.drawRect(20, 150, 100, 100);
          g.fillRect(20, 150, 100, 100);
          g.fillOval(150, 20, 100, 100); 
      }
  }
  </code></pre>
  
  <p>Nowhere in the main method is paint() being called on the canvas. But I ran the program and it works, so how is the paint() method being run?</p>