我设计了一个JFrame
,并使用GraphicsDevice
将其设置为全屏模式,问题是JFrame
现在总是在顶部,我看不到另一个窗口,即使我按 Alt + Tab 。如何在使用JFrame
?
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();
}
}