Рамка и холст становятся больше, чем указано

Я понятия не имею, почему я получаю очень большое окно, это заставляет меня запускать обручи, чтобы соответствовать моим спрайтам в окне игры. Конструктор должен сделать так, чтобы все подкомпоненты вписывались друг в друга, но кажется, что в канве или рамке есть некоторые дополнительные отступы. Мне тяжело понять, кто виноват. Размер моей рамки НЕ должен быть больше, чем 800x600 (украшение ОС не включено, говоря о контейнерах).

Panel: java.awt.Rectangle[x=0,y=0,width=810,height=610]
Frame: java.awt.Rectangle[x=0,y=0,width=816,height=638]
Canvas:java.awt.Rectangle[x=0,y=0,width=816,height=638]

Как видите, границы больше, чем я указал.

Класс:

public class GameFrame {
private JFrame frame;
private JPanel panel;
private Canvas canvas;
private BufferStrategy bufferStrategy;
private Graphics2D g;
private int width;
private int height;

public GameFrame(Color bgColor) {
    this.width = GameEngine.GAMEDIMENSION[0]; // 800
    this.height = GameEngine.GAMEDIMENSION[1]; // 600
    this.frame = new JFrame();
    this.panel = (JPanel) frame.getContentPane();
    this.panel.setPreferredSize(new Dimension(width, height));
    this.panel.setLayout(null);
    this.panel.setBackground(bgColor);
    this.canvas = new Canvas();
    this.canvas.setBounds(0, 0, width, height);
    this.canvas.setIgnoreRepaint(true);
    this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    this.frame.pack();
    this.frame.setResizable(false);
    this.frame.setVisible(true);
    this.panel.add(canvas);
    this.canvas.createBufferStrategy(2);
    this.bufferStrategy = canvas.getBufferStrategy();
    this.g = (Graphics2D) bufferStrategy.getDrawGraphics();
    this.canvas.requestFocus();

}

Главный:

public static void main(String[] args) {
    GameFrame gf = new GameFrame(Color.black);
    System.out.println("Panel: " + gf.panel.getBounds());
    System.out.println("Frame: " + gf.frame.getBounds());
    System.out.println("Canvas:" + gf.frame.getBounds());

    for (int R = 0; R < 255; R++) {
        for (int B = 0; B < 255; B++) {
            for (int G = 0; G < 255; G++) {
                gf.g.setColor(Color.black);
                gf.g.fillRect(0, 0, gf.width, gf.height);
                gf.g.setColor(new Color(R, B, G));
                gf.g.fillRect(0, 0, gf.width, gf.height);
                gf.bufferStrategy.show();
            }
        }
    }

}

В основном я пытаюсь зациклить квадраты, чтобы увидеть эффект.

Ответы на вопрос(1)

Ваш ответ на вопрос