Question

Ello, world. I am using Java 7, developing for MacOS Mavericks, and need to go totally fullscreen with window (preferable JFrame). I have set up a class that I can call upon to create a fullscreen window, which works fine for now, but with one caveat: It does not cover up the menu bar along the top of the MacOS interface! I have tried other posts, but none of those replies helped this scenario.

Here is my current FullScreen class:

public class Fullscreen extends Window{

    private static final long serialVersionUID = 1L;

    public Fullscreen() {

        super(new Frame());
        setLayout(new FlowLayout());
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(0,0,screenSize.width, screenSize.height);

    }

}

I notice that in other answers I've found, the CocoaPods API is necessary, but due to portability concerns, I cannot be using any platform-specific APIs.

Was it helpful?

Solution

You can try with JFrame as well

JFrame frame = new JFrame();
JFrame.setDefaultLookAndFeelDecorated(true);
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top