Is there a way to tell if a JFrame is “Maximised” (MS Windows) [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-23 12:28:29

问题


I've been Java applications on OS X, and haven't had the opportunity to fully test in different places.

There are 2 different JFrames. The second is loaded exactly in place of the first one, and as such needs to have its size and location set to the same as the first.

This works fine, but I noticed a lot of Windows users seem to maximise the first window. When the second JFrame loads, it has the same size, but is not "maximised".

Maximised windows in the MS Windows world have a slightly different state and are treated differently by the OS.

How can I tell if a JFrame is Maximised, and how can I maximise one myself?


回答1:


frame.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );


来源:https://stackoverflow.com/questions/15682182/is-there-a-way-to-tell-if-a-jframe-is-maximised-ms-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!