Ola, estou criando um jogo em java, e tenho 2 variaveis WIDTH E HEIGHT, gostaria de saber como poderia pegar o tamanho da janela e armazenar nessas variaveis, para nao deixar a janela em um tamanho fixo e o jogador conseguir colocar em tela cheia
int width = objetoDaMinhaJanela.getWidth();
int height = objetoDaMinhaJanela.getHeight();
Ou
Dimension size = objetoDaMinhaJanela.getSize();
int width = size.width;
int height = size.height;
Ou
Rectangle bounds = objetoDaMinhaJanela.getBounds();
int width = bounds.width;
int height = bounds.height;