我用java在netbeans 7.2中创建了一个gui应用程序。我在那里创建了一个JFrame。在自动生成的代码中,它被设置为nimbus外观。但是我的框架看起来不像光环。
所以我调试了代码,发现nimbus在getInstalledLookAndFeels()返回的数组中不可用。
那么我应该怎么做才能安装nimbus外观呢?JDK 1.6用来编译代码。
发布于 2012-11-01 21:35:08
确保您的java版本高于: JDK 6 Update 10。
See here
Java是JavaSE6Update10 (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
}
});https://stackoverflow.com/questions/13177534
复制相似问题