How to make a JFrame really fullscreen?

后端 未结 5 2076
深忆病人
深忆病人 2020-12-14 17:46

In my Java application I try to make a JFrame really fullscreen by using this code:

public class MainFrame extends JFrame {

    private static final long se         


        
5条回答
  •  萌比男神i
    2020-12-14 18:26

    Use com.apple.eawt.FullScreenUtilities. And make sure to test that the system is running Mac OS.

    public void enableFullscreen(Window window, boolean bool) {
        if (System.getProperty("os.name").startsWith("Mac OS")) {
            com.apple.eawt.FullScreenUtilities.setWindowCanFullScreen(window, bool);
    
        }
    
    }
    

提交回复
热议问题