今天在做一个GUI 的小程序时,出现了这样一个异常,我学java以来第一遇到:
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 cn.edu.hunnu.Test.<init>(Test.java:5)
at cn.edu.hunnu.Test.main(Test.java:7)
Caused by: java.lang.IllegalArgumentException: 90 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.setDesktopAAHints(Unknown Source)
at sun.awt.windows.WToolkit.initializeDesktopProperties(Unknown Source)
at java.awt.Toolkit.getDesktopProperty(Unknown Source)
at javax.swing.UIManager.<clinit>(Unknown Source)
... 11 more
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 cn.edu.hunnu.Test.<init>(Test.java:5)
at cn.edu.hunnu.Test.main(Test.java:7)
Caused by: java.lang.IllegalArgumentException: 90 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.setDesktopAAHints(Unknown Source)
at sun.awt.windows.WToolkit.initializeDesktopProperties(Unknown Source)
at java.awt.Toolkit.getDesktopProperty(Unknown Source)
at javax.swing.UIManager.<clinit>(Unknown Source)
... 11 more
我查了很久的资料,网上的这类问题好像也有,但是最终都没有解决问题,后面我终于找到了一篇文章,帮我解决了这个问题。文章上说有可能是我的LCD显示器的ClearType的设置有问题,我猛的一惊,终于想起自己用优化大师对我的ClearType进行了修改,于是我最后解决了问题。
解决方法:
桌面右击属性,外观,效果,使用下列方式使屏幕字体的边缘平滑的勾去掉或同时选择标准。
转载于:https://blog.51cto.com/beyond99/298125