title: Java offset drawing canvas
body: <p>I am trying to make a simple java game, and i got stumped on this. The game requires that you play in a square window, but can resize the sprites on the canvas. I though it would be really annoying if I used a ComponentListener and didn't let the user change size, so I thought that I would just offset the canvas from the left and right side so that it is centered until it is square.</p>
  
  <p>Right now I understand that I need to create a Canvas object for the Game, and then offset it but I'm not sure how.
  Game Canvas:</p>
  
  <pre><code>public class GameCanvas extends Canvas {
      public Vector size;
      public GameCanvas(Vector size) {
          this.size = size;
          setBackground(Color.BLUE);
          setSize(size.x, size.y);
      }
  }
  </code></pre>
  
  <p>Any help is appreciated :) thank you.</p>