我一直致力于全屏摇摆计划,并且最近购买了一台新笔记本电脑。
在这款新笔记本电脑上,字体在程序中不会显示相同的内容,我认为这意味着字体" MT Footlight light"没有安装在这台电脑上。然而,更重要的是,即使在调用toFront()或requestFocus()之后,我创建的JDialog也没有出现在屏幕的前面。
我可以提供SSCCE,但代码在我使用的其他计算机上运行良好,具有相同的操作系统(Windows 8)和不同的(Windows 7),所以如果有人有任何想法可以解决问题来源请告诉我
编辑:
它开始看起来可能不是新电脑,虽然我还没有真正用JDialog编辑部件,但是这里有SSCCE几乎所有影响JDialog的东西
public class Runner {
public static void main(String[] args){
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
new MainFrame(devices[0]);
}
}
public MainFrame(GraphicsDevice graphicsDevice){
super();
this.setGraphicsDevice(graphicsDevice);
this.setOrigDisplay(graphicsDevice.getDisplayMode());
//Sets the panel to its default start screen, the main menu
setPanel(new MainMenuPanel(this));
//Resizes to full-screen
if (graphicsDevice.isFullScreenSupported()){
this.dispose();
setUndecorated(true);
setResizable(false);
graphicsDevice.setFullScreenWindow(this);
//this.setVisible(false);
revalidate();
}else{
System.out.println("Full-screen mode not supported");
}
//Applies the custom theme
try {
Theme.loadTheme(new File("res/IS.theme"));
UIManager.setLookAndFeel(new TinyLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(this);
Toolkit.getDefaultToolkit().setDynamicLayout(false);
System.setProperty("sun.awt.noerasebackground", "true");
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds(0, 0, size.width, size.height);
}
public class OptionsPanel extends JPanel{
private final MainFrame context;
private SetupDialog setup;
public OptionsPanel(final MainFrame m){
super();
setLayout(new GridBagLayout());
this.context = m;
JButton setupButton = new JButton("Run set-up");
setupButton.setFont(Constants.FONT_BIG);
setupButton.setMargin(new Insets(20,20,20,20));
setupButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
//TODO
setup = new SetupDialog(context);
}
});
//Other options stuff
}
}
public class SetupDialog extends JDialog{
private MainFrame context;
private JList<Info> midiSystemList;
private int instruction;
private NoteListener n;
public SetupDialog(MainFrame m){
super(m);
this.context = m;
//setTitle("Set-up");
this.setUndecorated(false);
this.setLocationRelativeTo(null);
//Does setup stuff
this.setUndecorated(true);
pack();
setModal(true);
setVisible(true);
}
}
答案 0 :(得分:0)
我设法通过使用
从实际的全屏模式更改为其他类型来解决我的问题this.setExtendedState(JFrame.EXTENDED_BOTH);
this.setUndecorated(true);
我仍然不确定是什么改变了,因为我以前能够在常规全屏模式下使用JDialogs,但是这个解决方案仍然有用