lak*_*man 4 java swing look-and-feel nimbus
我在java中的netbeans 7.2中创建了一个gui应用程序.我在JFrame那里创造了一个.在自动生成的代码中设置为nimbus外观.但我的框架看起来不像雨云.
所以我调试代码,发现nimbus在返回的数组中不可用getInstalledLookAndFeels().
那么我该怎么做才能安装灵气的外观和感觉呢?JDK 1.6用于编译代码.
确保您的Java版本大于:JDK 6 Update 10.
看到这里:
Nimbus是Java SE 6 Update 10(6u10)版本中引入的优质跨平台外观.
你可以在这里下载最新的Java(7u9)和Netbeans(7.2.1)版本(捆绑):
在那之后你应该好好去,别忘了从里面设置L&F Event Disptach Thread:
//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
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1679 次 |
| 最近记录: |