看看這張圖: 能在JDK7不是透明的和未修飾的JFrame使靈氣
這裏是透明的框架代碼:
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) {
System.err.println(
"Translucency is not supported");
System.exit(0);
}
JFrame.setDefaultLookAndFeelDecorated(true);
這工作不錯,但試圖啓用時加入
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
}catch(.......)
的LookAndFeel它給了我這個錯誤
螺紋例外 「AWT-EventQueue的 - 0」 java.awt.IllegalComponentStateException:框架裝飾
這是什麼錯誤?以及如何解決它?
感謝您的回答和建議。
編輯
問問題/ CrossPosted
變化的主要方法的LAF UI之前,形成 – 2013-04-25 15:43:48
'@Sri戒Chilakapati'我很抱歉,但如果你描述更多 – Azad 2013-04-25 15:50:08
我沒有得到你,我會理解的問題是,既然你在啓用透明度後設置外觀。它給出了例外,因爲靈氣不支持裝飾框架。 – 2013-04-25 16:26:25