我不知道如何准确地回答你的问题。我所能做的就是展示我如何使用不同的 UI 运行我的应用程序,请参见下文。该示例显示了我如何从Substance 库安装 Look and Feels 之一。
public static void main(String[] argv) throws InterruptedException, InvocationTargetException
{
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
try
{
UIManager.setLookAndFeel(new SubstanceSaharaLookAndFeel());
//Some people say the below should also be called but even without it always worked for me so what is this for then?
//SwingUtilities.updateComponentTreeUI(frame);
}catch(Exception e)
{
Logger.getLogger(MyApplicationFrame.class.getName()).log(Level.SEVERE, null, e);
System.out.println("Substance look and feel failed to initialize");
}
new MyApplicationFrame();
}
});
}
至于代码中关于调用的注释,SwingUtilities.updateComponentTreeUI(frame);
我猜想在应用程序已经运行时更改外观时需要它。
希望对你有任何帮助。