JFrame全屏聚焦。 [英] JFrame full screen focusing .
问题描述
//设置全屏
$这是我设置一个JFrame到全屏模式的方式b $ b frame.dispose();
frame.setUndecorated(true);
screenDevice.setFullScreenWindow(frame);
frame.setVisible(true);
//重置为窗口模式
frame.dispose();
screenDevice.setFullScreenWindow(null);
frame.setUndecorated(false);
frame.setVisible(true);
但是,当我显示任何对话框,像设置对话框,对话框和全屏幕框架都丢失他们的foucs和屏幕上消失。然后我需要点击任务栏图标才能获得焦点。
如何解决这个问题?谢谢。
编辑:
假设在这个全屏窗口的菜单栏中有一个JMenuItem ,然后我通过点击这样的menuitem使可见的设置JDialog:
$ p $ settingsMenuItem.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
settingsDialog.showSettingsDialog();
}
});
在全屏模式下,屏幕上不显示settingsDialog和全屏幕。如果你想设置你的 This is how i am setting a JFrame to full screen mode : But, when i display any dialog, something like settings dialog, the dialog and full screen frame both lost their foucs and disappear on screen. Then i need to click in the taskbar icon to get the focus. How to solve this issue ? Thank you. Edit: Suppose if there is a JMenuItem in the menu bar of this full screen window, then i am making visible a settings JDialog by clicking the menuitem like this: The settingsDialog and full screen are not showing on the screen in full screen mode. in window mode it works normally. If you want to set your
这篇关于JFrame全屏聚焦。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! JFrame $ c $的话, c> to
最大化为什么不使用这个:
$ p $ frame $ set $ c $> frame.setExtendedState Frame.MAXIMIZED_BOTH);
//set full screen
frame.dispose();
frame.setUndecorated(true);
screenDevice.setFullScreenWindow(frame);
frame.setVisible(true);
//reset to window mode
frame.dispose();
screenDevice.setFullScreenWindow(null);
frame.setUndecorated(false);
frame.setVisible(true);
settingsMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
settingsDialog.showSettingsDialog();
}
});
JFrame
to maximized
why not use this:frame.setExtendedState(Frame.MAXIMIZED_BOTH);