Search code examples
javaawtframefullscreenmaximize-window

How do you set a frame (awt)'s size to fullscreen in a simple java statement?


I would like to set my frame automatically to fullscreen. Is this possible, and if yes how?

Thanks


Solution

  • If you want to maximize your frame use:

    frame.setExtendedState(Frame.MAXIMIZED_BOTH);
    

    If you want the frame to have no decoration (truly fullscreen) use this aswell:

    frame.setUndecorated(true);