ggds

 

Java原始界面不是很漂亮,下面介绍四种外观风格:
使用方法:

把下列代码,选择后,粘贴到public static void main(String[] arg){}里,主界面类的前面。

当然,前面也需要导入,

import javax.swing.UIManager;

try {

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");//Nimbus风格,jdk6 update10版本以后的才会出现
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());//当前系统风格
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");//Motif风格,是蓝黑
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());//跨平台的Java风格
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");//windows风格
//UIManager.setLookAndFeel("javax.swing.plaf.windows.WindowsLookAndFeel");//windows风格
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");//java风格
//UIManager.setLookAndFeel("com.apple.mrj.swing.MacLookAndFeel");//待考察,

} catch (Exception e) {
e.printStackTrace();
}

//以下语句没有试验,直接加在main()中即可
不过,需要使用UpdateComponentUI()这个方法!不然没效果.

即SwingUtlilites.updateComponentTreeUI(getContentPare());  

分类:

技术点:

相关文章:

  • 2021-11-13
  • 2021-12-14
  • 2021-09-08
  • 2021-12-19
  • 2022-01-11
  • 2021-10-27
  • 2021-11-14
  • 2021-09-30
猜你喜欢
  • 2021-10-04
  • 2021-12-19
  • 2021-09-24
  • 2021-10-20
  • 2022-01-02
  • 2021-12-04
相关资源
相似解决方案