Search code examples
javaswingfullscreen

JFrame in full screen Java


I will be doing a project soon and I will have to use full screen mode in it.

It will draw some graphics in the window. It would be convienient if I use JFrame or something similar.

I don't know what the final resolution of the screen will be. Please tell me if the graphics will be automaticly rescaled?

JFrame jf = new JFrame();
jf.setSize(1650,1080);
//make it fullscreen;
//now is everything is going to be rescaled so it looks like the original?

Solution

  • Add:

    frame.setExtendedState(JFrame.MAXIMIZED_BOTH); 
    frame.setUndecorated(true);
    frame.setVisible(true);