0
我一直在全屏搖擺計劃,最近購買了一臺新的筆記本電腦。JDialog沒有顯示在新電腦上?
在這款新筆記本電腦上,字體在程序中沒有顯示出來,我想這意味着字體「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);
}
}
您是否在兩個系統上使用相同的jdk實現? – Jimmy
我有eclipse和外部硬盤上的jre,所以它應該是 –
如果你在命令行中運行會發生什麼?它是否打印任何錯誤消息? –