介绍:Java Swing的开发中UI的设置和润色比较复杂,简单的方法就是设置LookAndFeel.
1. java自带的
1.Java Swing自带的LookAndFeel可以根据系统名称来设置。
文档:http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
比如:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
2.还可以设置Nimbus Look and Feel
文档http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html
2. 其他美化包
1. Seaglass 苹果风格的美化包,跨平台的Java Swing外观,只支持JRE1.6以上运行的环境。
下载地址:https://code.google.com/p/seaglass/
方法:1.下载美化包并添加;
2.在程序中设置:
UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel"); UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Microsoft Yahei",Font.PLAIN,13));
优点是:设计清新自然
缺点是:对中文字符的支持有不少问题。
2. Substance 包含多类美化风格的美化包
下载地址: https://java.net/projects/substance/
比如:
UIManager.setLookAndFeel(new org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel());
其他的可以设置的有:
3. JTattoo包含多个美化风格的美化包
下载地址:http://www.jtattoo.net/Download.html
设置方法:
UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
其他的还有很多,看完上边的一般就有思路了,下面是一些从网上搜到的java swing美化包的链接,仅供参:
1. JGoodies http://www.jgoodies.com/products/swing-suite/
2. Jide http://www.jidesoft.com/products/
3. Liquidlnf https://java.net/projects/liquidlnf/
4. Napkin Look & Feel http://napkinlaf.sourceforge.net/
5. PgsLookAndFeel http://www.pagosoft.com/projects/pgslookandfeel/
6. Quaqua http://www.randelshofer.ch/quaqua/index.html
7. The Alloy Look and Feel http://lookandfeel.incors.com/
8. WebLookAndFeel http://weblookandfeel.com/
9. javootoo.com http://www.javootoo.com/
10.Synthetica Themes - Custom L&Fs http://www.javasoft.de/synthetica/themes/
3. 另外,如果想要创建自己的Look and Feel,可以参考一下资料:
1. How to Write a Custom Look and Feel
https://today.java.net/pub/a/today/2006/09/12/how-to-write-custom-look-and-feel.html
2. Modifying the Look and Feel
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/
2. Java Look And Feel Libraries/Engines: Cezanne L&F engine
http://www.centigrade.de/en/products/cezanne-look-and-feel-engine
其他相关资料:
· Best Java Swing Look and Feel Themes | Top 10
· oracle.com - Modifying the Look and Feel
· wikipedia.org - Pluggable look and feel
· Java2s.com - Look and feel
· Java Look and Feel (L&F)