substance的使用示例(转)

时间:2023-03-09 15:29:06
substance的使用示例(转)

可以使用substance改变界面的皮肤和主题,让Java制作的界面“炫”起来 
。 
可以下载substance.jar文件 
在代码中你可以用:

  1. static {
  2. try {
  3. try {
  4. UIManager.setLookAndFeel(new SubstanceLookAndFeel());
  5. } catch (UnsupportedLookAndFeelException ex) {
  6. System.out.println(ex.getMessage());
  7. }
  8. } catch (Exception ex) {
  9. System.out.println(ex.getMessage());
  10. }
  11. //设置皮肤
  12. //  SubstanceSaharaLookAndFeel.setSkin(new CremeSkin());
  13. SubstanceSaharaLookAndFeel.setSkin(new AutumnSkin());
  14. //SubstanceSaharaLookAndFeel.setCurrentButtonShaper(new StandardButtonShaper());
  15. //SubstanceSaharaLookAndFeel.setFontPolicy(new DefaultMacFontPolicy());
  16. //设置水印
  17. SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark());
  18. //设置主题
  19. // SubstanceLookAndFeel.setCurrentTheme(new SubstanceCremeTheme());
  20. SubstanceLookAndFeel.setCurrentTheme(new SubstanceLightAquaTheme());
  21. //  SubstanceLookAndFeel.setCurrentTheme(new SubstanceOliveTheme());
  22. //  SubstanceLookAndFeel.setCurrentTheme(new SubstanceJadeForestTheme());
  23. //设置题头
  24. SubstanceLookAndFeel.setCurrentTitlePainter(new Glass3DTitlePainter());

下载下来substance.jar包后,解压JAR文件,可以看到在“org/jvnet/substance/skin”下有下面这些皮肤(以LookAndFeel.class结尾的文件)。 
共有22种皮肤,69种主题,自己设置

我给你个地址吧,上面全是开源的外观,可以直接拿来用,很方便 
http://www.open-open.com/61.htm

http://www.iteye.com/problems/70945