[英]nimbus look and feel is not available
我在Java的netbeans 7.2中創建了一個gui應用程序。 我在那里創建了一個JFrame
。 在自動生成的代碼中將其設置為nimbus外觀。 但我的框架看起來不像靈氣。
所以我調試了代碼,發現nimbus在getInstalledLookAndFeels()
返回的數組中不可用。
那么我該如何安裝nimbus外觀? JDK 1.6用來編譯代碼。
確保您的Java版本大於:JDK 6 Update 10。
看這里 :
Nimbus是在Java SE 6 Update 10(6u10)發行版中引入的優美的跨平台外觀。
您可以在此處下載最新的Java(7u9)和Netbeans(7.2.1)版本(捆綁):
之后,您應該一切順利,也不要忘記從Event Disptach Thread
設置L&F:
//Create UI and set L&F on EDT
SwingUtilities.invokeLater(new Runnable( ) {
public void run( ) {
//set L&F
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
e.printStackTrace();
}
//create UI and components here
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.