title: Java Canvas white edge
body: <p>So I'd like to make a <code>Canvas</code> based Java application. I've extended my main class to <code>Canvas</code> and I size it in it's constructor.</p>
  
  <pre><code>public CanvasApp() {
      Dimension size = new Dimension(640, 480);
      setSize(size);
      setPreferredSize(size);
      setMinimumSize(size);
      setMaximumSize(size);
  }
  </code></pre>
  
  <p>and in the main function, I make a frame for it, like this:</p>
  
  <pre><code>CanvasApp cnv = new CanvasApp();
  JFrame frame = new JFrame("");
  JPanel panel = new JPanel(new BorderLayout());
  panel.setBorder(null); //I've tried this
  panel.setSize(640,480); //but still doesn't work =(
  panel.add(cnv, BorderLayout.CENTER);
  
  frame.setContentPane(panel);
  frame.pack();
  frame.setResizable(false);
  frame.setLocationRelativeTo(null);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  </code></pre>
  
  <p>But the content pane appears 650x490 in size. Why is this?</p>
  
  <p>I've attached a picture too.</p>
  
  <p><a href="http://i.imgur.com/LAtRK.png" rel="nofollow">I've drew a line from 0,0 to 640,480</a></p>