0
我正在開發具有全屏功能的Swing應用程序。在任何關鍵事件中,我嘗試使用setFullScreenWindow(null)退出全屏窗口,但它不起作用。 這是代碼。setFullScreenWindow(null)在MAC OS中不工作x Swing應用程序
設置的JFrame全屏
frame.getJMenuBar().setVisible(false);
gd.setFullScreenWindow(frame);
frame.setVisible(false);
frame.setVisible(true);
代碼,以便在關鍵事件退出全屏代碼:
@Override
protected void process(List<Boolean> chunks) {
for(Boolean b:chunks){
System.out.println(b);
if(b){
if(timer !=null)
timer.stop();
Window window = gd.getFullScreenWindow();
if(window != null){
window.dispose();
}
gd.setFullScreenWindow(null);
frame.getJMenuBar().setVisible(false);
}
}
}
請指點。 :(