当我在 NetBeans 中运行程序时,nimbus 外观和感觉在创建 jar 后没有出现,但当我创建 Jar 并从 jar 运行应用程序时,nimbus 外观没有出现代码:
public static void main(String[] args)
{
boolean isNimbus = false;
try {
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".equals(info.getName()))
{
UIManager.setLookAndFeel(info.getClassName());
isNimbus = true;
break;
}
}
if(!isNimbus)
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
} catch (ClassNotFoundException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Dashboard dashboardObj = new Dashboard();
}