简体   繁体   中英

How do you set your JFame's size to be as big as your computer's screen in java?

I wanted to make a game in java, but i don't know if there is a way to set the size of the JFrame to cover the whole computer screen without actually going and setting the size myself to try to match up with your computer screen size.

PS I do know how to set the size of the JFrame but i don't know how to make it the same size as my computer screen without trial and error my way through by changing to size over and over again. Thanks!!

为了最大化您的JFrame,您可以使用

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

而不是将大小设置为值,请在JFrame使用setExtendedState(JFrame.MAXIMIZED_BOTH)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM