title: Swing Canvas not painting as expected (or at all)
body: <pre><code>public class TerrisView extends JFrame {
      public Canvas canvas;
  
      public TerrisView(String title) {
          super(title);
          canvas = new Canvas();
          canvas.setSize(300, 400);
          canvas.setBackground(Color.WHITE);
          // setSize(300, 400);
          this.add(canvas, BorderLayout.CENTER);
          pack();
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setVisible(true);
          paint();
  
      }
  
      public void paint() {
  
          // this.createBufferStrategy(2);
          // Graphics gp=getBufferStrategy().getDrawGraphics();
          // gp.setColor(Color.RED);
          // gp.fillRect(100, 100, 50, 50);
          // getBufferStrategy().show();
          Graphics gp = canvas.getGraphics();
          gp.setColor(Color.BLACK);
          gp.fillRect(0, 0, 10, 10);
  
      }
  
  }
  </code></pre>
  
  <p>Why does it fail to draw the <code>Rect</code> on the canvas?  What is wrong with the code?</p>