简体   繁体   中英

Set Jframe not to be on top always

I have designed a JFrame and set it to full screen mode using GraphicsDevice , the problem is that JFrame is now always on top and I can't see the other window, even when I press Alt + Tab . How do I correctly get the JFrame to not always be on top when using GraphicsDevice ?

public class MyResolution {

        public MyResolution() {
            GraphicsEnvironment env=GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice device=env.getDefaultScreenDevice();
            GraphicsConfiguration gc=device.getDefaultConfiguration();
            JFrame frame=new JFrame();
            DisplayMode mode=new DisplayMode(1024, 768, 16,0);
            device.setFullScreenWindow(frame);
            frame.setSize(300,500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            DisplayMode[] modes = device.getDisplayModes();
            for (int i = 0; i < modes.length; i++) {
                //System.out.println("Best display mode: "+mode+", Modes:-"+modes[i]);
                if (modes[i].getWidth() == mode.getWidth()
                        && modes[i].getHeight() == mode.getHeight()
                        && modes[i].getBitDepth() == mode.getBitDepth()) {
                    device.setDisplayMode(mode);            }
            }
            frame.enableInputMethods(false);    
            frame.setAlwaysOnTop(false);
        }

        public static void main(String[] args) {
                MyResolution mine=new MyResolution();       
        }
}

Use next for your JFrame frame.setAlwaysOnTop(false); .

frame is your JFrame .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM