我在使用Swing時遇到了問題。我不知道這是什麼原因,但我只是想用swing創建一個簡單的框架應用程序,它給了我很多錯誤。Swing應用程序無法運行
import javax.swing.JFrame;
public class StacksGui {
public static void main(String args[])
JFrame frame = new JFrame();
frame.setVisible(true);
frame.setSize(100,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
Exception in thread "main" java.lang.ExceptionInInitializerError
at javax.swing.JPanel.updateUI(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JPanel.<init>(Unknown Source)
at javax.swing.JRootPane.createGlassPane(Unknown Source)
at javax.swing.JRootPane.<init>(Unknown Source)
at javax.swing.JFrame.createRootPane(Unknown Source)
at javax.swing.JFrame.frameInit(Unknown Source)
at javax.swing.JFrame.<init>(Unknown Source)
at StacksGui.main(StacksGui.java:9)
Caused by: java.lang.IllegalArgumentException: 0 incompatible with Text-specific LCD contrast key
at java.awt.RenderingHints.put(Unknown Source)
at sun.awt.windows.WDesktopProperties.getDesktopAAHints(Unknown Source)
at sun.awt.windows.WToolkit.getDesktopAAHints(Unknown Source)
at sun.awt.SunToolkit.getDesktopFontHints(Unknown Source)
at sun.awt.windows.WDesktopProperties.getProperties(Unknown Source)
at sun.awt.windows.WToolkit.updateProperties(Unknown Source)
at sun.awt.windows.WToolkit.lazilyInitWProps(Unknown Source)
at sun.awt.windows.WToolkit.lazilyLoadDesktopProperty(Unknown Source)
at java.awt.Toolkit.getDesktopProperty(Unknown Source)
at javax.swing.UIManager.<clinit>(Unknown Source)
... 10 more
你的主要位置在哪裏? –
這似乎是不完整的。堆棧跟蹤表明您有一個主要方法,但未顯示。 – Radiodef
對不起!我忘了把我的主要但仍然我的輸出仍然是一樣的。很多錯誤。 –