我试图使我的程序具有切换键,以在全屏和非全屏之间切换。但是当进入全屏模式时,不属于原始渲染的所有内容都会像闪光灯一样闪烁。为什么会这样?
fullScreen = !fullScreen;
GraphicsDevice dev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
if(fullScreen) {
width = Toolkit.getDefaultToolkit().getScreenSize().width;
height = Toolkit.getDefaultToolkit().getScreenSize().height;
dev.setFullScreenWindow(frame);
frame.pack();
} else {
canvas.setSize(new Dimension(initWidth, initHeight));
width = initWidth;
height = initHeight;
frame.pack(); // Resizes frame to adjust to canvas.
dev.setFullScreenWindow(null);
frame.setVisible(true);
}
预先感谢:)