Hello, I have problem setting the size of drawing panel. I want a drawing panel with the size 0f 600,600.However I found that, the size of the drawing panel is smaller than 600,600. It seems that the frame size is 600,600 which make the drawing panel smaller. How can I set the drawing panel size 600,600 ?
....
public class DrawingBoardWithMatrix extends JFrame {
   public static void main(String[] args) {
      new DrawingBoardWithMatrix();
   }
   public DrawingBoardWithMatrix(){     
      this.getContentPane().setBackground(Color.WHITE);
      this.setSize(600, 600);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      this.add(new PaintSurface(), BorderLayout.CENTER);
      this.setVisible(true);
      setResizable(false);    
   }
I have changed the code,however the problem still exist. At this time the size of the drawing panel is larger than the intended size dimension.
public class DrawingBoardWithMatrix extends JFrame {
  public static void main(String[] args) {
      new DrawingBoardWithMatrix();
  }
  public DrawingBoardWithMatrix(){  
      Container c = getContentPane();
      c.add(new PaintSurface(), BorderLayout.CENTER);
      c.setPreferredSize(new Dimension(600,600));
      pack();
      this.setVisible(true);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    
      setResizable(false); 
  }