title: Errors displaying buffered image
body: <p>I have recently been following a tutorial on how to make a 2D game in java. I know all the concepts and I am using the video as a guide line so that I can get everything setup and then start pumping all of my ideas and content into the skeleton.</p>
  
  <p>I was following this(<a href="http://www.youtube.com/watch?v=VE7ezYCTPe4" rel="nofollow">http://www.youtube.com/watch?v=VE7ezYCTPe4</a>) tutorial when I ran into a problem. About 28 minutes into the video I type this code:</p>
  
  <pre><code>public void render() {
      BufferStrategy bs = getBufferStrategy();
      if(bs == null) {
          createBufferStrategy(3);
          return;
      }
  
      Graphics g = bs.getDrawGraphics();
  
      g.setColor(Color.BLACK);
      g.fillRect(0, 0, getWidth(), getHeight());
  
      g.dispose();
      bs.show();
  }
  </code></pre>
  
  <p>This was all fine until I tried to run it. He runs it in the video and it works just fine, but when I run it I get an error:</p>
  
  <blockquote>
    <p>Exception in thread "Thread-2" java.lang.IllegalStateException: Component must have a valid peer at java.awt.Component$FlipBufferStrategy.createBuffers(Unknown Source) at java.awt.Component$FlipBufferStrategy.(Unknown Source)
        at java.awt.Component$FlipSubRegionBufferStrategy.(Unknown Source)
        at java.awt.Component.createBufferStrategy(Unknown Source)
        at java.awt.Canvas.createBufferStrategy(Unknown Source)
        at java.awt.Component.createBufferStrategy(Unknown Source)
        at java.awt.Canvas.createBufferStrategy(Unknown Source)
        at com.kaperly.game.Game.render(Game.java:102)
        at com.kaperly.game.Game.run(Game.java:83)
        at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>I would really like to continue the video and be on my way to making my first fully functional game (All other game attempts never made it to functional stages.)</p>