title: Why is this simpler implementation of Java graphics not used?
body: <p>I've been reading up on Java graphics, and all guides seem to point to more complicated implementations of graphics into Java; reading a bit about repaint(), I came up with this portion of code, which seems to work for the little that I have tested it with -</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class Boids extends JFrame{
  
       public Boids(){
          setSize(400,400);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setVisible(true);   
       }
  
       public static void main(String[] a){
          Boids boids = new Boids();
          while(true) {
              boids.repaint();
          }
       }
  
       public void paint(Graphics g){
          // The code for Boids
       }
  }
  </code></pre>
  
  <p>My question is; is this code bad in some way? Is it going to hurt me down the road?
  If not, why is this not used, as it seems much simpler and shorter than other versions of code I have seen.</p>