我将应用程序LookAndFeel从Darcula更改为Metal时遇到问题。当我从Metal => Darcula或Metal< => Nimbus改变时,一切都还可以。
我使用来自darcula-1.0.0.jar的Darkula LookAndFeel
开始时:
BasicLookAndFeel darcula = new DarculaLaf();
try {
UIManager.setLookAndFeel(darcula);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(windows.class.getName()).log(Level.SEVERE, null, ex);
}
使用此代码更改主题:
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(windows.class.getName()).log(Level.SEVERE, null, ex);
}
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
在此之后,Darkula LookAndFeel的一些颜色不会变为Metal theme(应该)的颜色,结果是具有深色背景和菜单的Metal主题。 怎么解决?