Java 中设置默认的样式


  1. private void setLF() {  
  2.         // Force SwingApp to come up in the System L&F   
  3.         String laf = UIManager.getSystemLookAndFeelClassName();  
  4.         try {  
  5.             // System.out.println("========================"+laf);   
  6.             UIManager.setLookAndFeel(laf);  
  7.         } catch (UnsupportedLookAndFeelException exc) {  
  8.             System.err.println("Warning: UnsupportedLookAndFeel: " + laf);  
  9.         } catch (Exception exc) {  
  10.             System.err.println("Error loading " + laf + ": " + exc);  
  11.         }  
  12.     }  
Swing就会调用不同的系统中的UI元素。

相关内容