Not really an answer, just debugging help.
How do you know the actual size of the panel is 800?
How do you know your x/y values are correct?
Don't use math expressions for parameters. Instead your code should be something like:
int size = 100;
int x = (Game.WIDTH - size) / 2;
int y = (Game.HEIGHT - size) / 2;
System.out.println("Panel size: " + getSize());
System.out.println(x + " : " + y);
g.drawRect(x, y, size, size);
This allows you to display the value of your parameters to make sure they are what you expect them to be.
Instead of hardcoding the width/height of the panel you should use the actual size of the panel as determined by the getSize() method.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…