-1

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.

P.S 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!!

jack zhang
  • 133
  • 3
  • 3
  • 10
  • possible duplicate of [JFrame in full screen Java](http://stackoverflow.com/questions/11570356/jframe-in-full-screen-java) – P M Apr 03 '15 at 20:23
  • See this post: http://stackoverflow.com/questions/11570356/jframe-in-full-screen-java – The Guest Apr 03 '15 at 20:24

2 Answers2

1

To maximize your JFrame you could use

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
Roland Weisleder
  • 9,668
  • 7
  • 37
  • 59
1

Instead of setting the size to a value, use setExtendedState(JFrame.MAXIMIZED_BOTH) in JFrame.

ave4224
  • 19
  • 2