0

Is there a way to do that without having the user type in their resolution manually? Thanks for any help in advance.

Matt cejpa
  • 15
  • 2
  • 5

3 Answers3

2

Use frame.setExtendedState(Frame.MAXIMIZED_BOTH); to make your Swing gui to full screen. refer Oracle doc for more information

2

Use

setExtendedState(JFrame.MAXIMIZED_BOTH);

http://docs.oracle.com/javase/6/docs/api/java/awt/Frame.html#setExtendedState%28int%29

Diogo Moreira
  • 1,082
  • 2
  • 9
  • 24
0

If you mean real full screen (not maximized window), then try setFullScreenWindow(Window w) method of GraphicsDevice class.

It is not supported in all systems. Your program can check it by isFullScreenSupported() of GraphicsDevice class.

It is more than 10 years when I used this, but if I remember correctly, There is no need to tell resolution to GraphicsDevice object before entering to the full screen mode. Display will keep the current resolution.

At least there is function getDisplayModes() in GraphicsDevice. So your program can select suitable resolution from the list of supported resolution. So there is no need to ask resolution from users.

More information here.

SKi
  • 8,007
  • 2
  • 26
  • 57