2010-03-15 38 views

回答

2

感谢您的答复。 通过使用下面的代码,我们可以得到所有的外观和感觉类名称。

UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels(); 
    for (int i = 0; i < lookAndFeelInfos.length; i++) { 
     UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i]; 

     // 
     // Get the name of the look and feel 
     // 
     String name = lookAndFeelInfo.getName(); 
     System.out.println("name = " + name); 

     // 
     // Get the implementation class for the look and feel 
     // 
     String className = lookAndFeelInfo.getClassName(); 
     System.out.println("className = " + className); 
    } 
+0

这将显示所有已安装的外观和感觉。 – Samurai 2010-03-15 05:44:08

3

您可以按照本教程太阳约setting the L&F in Java

您可以setLookAndFeel即使在程序的GUI是可见的改变将L & F。
要使现有组件反映新的L & F,请针对每个顶级容器调用一次方法SwingUtilitiesupdateComponentTreeUI
然后,您可能希望调整每个顶级容器的大小以反映其包含组件的新大小。例如:

UIManager.setLookAndFeel(lnfName); 
SwingUtilities.updateComponentTreeUI(frame); 
frame.pack(); 
+0

感谢您的回复。如何获得InfName的外观和感觉。我们在NetBeans中有windows classic(我使用的是Windows OS)主题。这是什么InfName。 – Samurai 2010-03-15 05:29:24

相关问题