Java JFrame Size according to screen resolution

后端 未结 7 1848
[愿得一人]
[愿得一人] 2020-12-09 17:48

I created java GUI using myEclipse Matisse. when my Screen Resolution is 1024x768 it works fine but when i change resolution my GUI is not working fine. I want my GUI window

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 18:37

    Calling pack() is vital to a correctly functioning GUI. Call it after all the components have been added, to have it validate the container and set it to it's natural size.

    Then call setSize() & related methods like setBounds() afterwards.

提交回复
热议问题