Why does Jframe have different sizes between window mode and full screen mode?

Asked

Viewed 50 times

0

Well, I was doing the setLocation so that the Graphics are compatible with any game resolution. Then I realized a certain problem when I tried to make a frame.getHeight - figura.getHeight (The picture would be the black bar at the bottom of the image) and then I realized that the size was wrong in window mode, but in full screen mode was correct.

So from what I understand it seems that window mode counts the title bar (with close, minimize) as part of its resolution. I wanted to know how to fix this problem, because if it continues like this I will not be able to control the objects using getHeight, in window mode it will be of one size and in full screen will be of another.

JFrame em modo janela (1920x1080)

JFrame em tela cheia (1920x1080)

Briefly, how to get only the height resolution of the window without taking the size of the titlebar.

  • 1

    I think you’re trying to make it yours JFrame undecorated, no?! Try to: jframe.setUndecorated(true);

  • Renan, setUndecorated defines whether the screen will be full screen or not. I need my graphics to be correct both in full screen and window mode, but this is not happening, because even if they are in the same resolution, the panels have different size. Example: in full screen mode it gets height of 1080,.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.