现在的位置: 首页 > java > spark > 正文
swing开源皮肤包 substance与jtatoo
2012年07月10日 spark ⁄ 共 3898字 暂无评论

 substance 是一款很漂亮的皮肤,使用方法:

UIManager.setLookAndFeel( new  SubstanceOfficeBlue2007LookAndFeel());

try  {
      UIManager.setLookAndFeel( " org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel " );
    }  catch  (Exception e) {
      System.out.println( " Substance Raven Graphite failed to initialize " );
    }

 

使标题栏也改变

Java代码 JFrame.setDefaultLookAndFeelDecorated( true );   
 

如果想要让JDialog也改变的话,还要再加上
Java代码  JDilog.setDefaultLookAndFeelDecorated(true);  
给应用程序添加水印或是背景
 

JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try  {
            SubstanceImageWatermark watermark  =   new  SubstanceImageWatermark(LoginFrame. class .getResourceAsStream( " /demo/001.jpg " ));
            watermark.setKind(ImageWatermarkKind.SCREEN_CENTER_SCALE);
            SubstanceSkin skin  =   new  OfficeBlue2007Skin().withWatermark(watermark);   //初始化有水印的皮肤

            UIManager.setLookAndFeel( new  SubstanceOfficeBlue2007LookAndFeel());
            SubstanceLookAndFeel.setSkin(skin);  //设置皮肤
          
        }  catch  (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(LoginFrame. class .getName()).log(Level.SEVERE,  null , ex);
        }
/**
注:
SubstanceLookAndFeel.setSkin(skin); 。
它必须要在 UIManager.setLookAndFeel( new  SubstanceOfficeBlue2007LookAndFeel()); 这句的下面。
否则你看不到水印的效果
**/

 

substance 效果列表

 

//Substance
  //"org.jvnet.substance.skin.SubstanceAutumnLookAndFeel",
  "org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel",
  "org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel",
  "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel",
  //"org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel",
  "org.jvnet.substance.skin.SubstanceCremeCoffeeLookAndFeel",
  "org.jvnet.substance.skin.SubstanceCremeLookAndFeel",
  "org.jvnet.substance.skin.SubstanceDustCoffeeLookAndFeel",
  "org.jvnet.substance.skin.SubstanceDustLookAndFeel",
  //"org.jvnet.substance.skin.SubstanceEmeraldDuskLookAndFeel",
  "org.jvnet.substance.api.skin.SubstanceGeminiLookAndFeel",
  "org.jvnet.substance.api.skin.SubstanceGraphiteAquaLookAndFeel",
  //"org.jvnet.substance.skin.SubstanceMagmaLookAndFeel",
  //"org.jvnet.substance.api.skin.SubstanceMagellanLookAndFeel",
  "org.jvnet.substance.skin.SubstanceMistAquaLookAndFeel",
  "org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel",
  "org.jvnet.substance.skin.SubstanceModerateLookAndFeel",
  "org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel",
  "org.jvnet.substance.skin.SubstanceNebulaLookAndFeel",
  "org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel",
  "org.jvnet.substance.skin.SubstanceOfficeSilver2007LookAndFeel",
  "org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel",
  "org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel",
  //"org.jvnet.substance.skin.SubstanceRavenLookAndFeel",
  "org.jvnet.substance.skin.SubstanceSaharaLookAndFeel",
  //"org.jvnet.substance.skin.SubstanceTwilightLookAndFeel"

 

 

还有个swing皮肤包  jtatoo   openfire  spark下有很多样式。
         Properties props = new Properties();
         String menubar = Default.getString(Default.MENUBAR_TEXT) == null ? ""
          : Default.getString(Default.MENUBAR_TEXT);
         props.put("logoString", menubar);
         try {
      Class<?> c = ClassLoader.getSystemClassLoader().loadClass(laf);
      Method m = c.getMethod("setCurrentTheme", Properties.class);
      m.invoke(c.newInstance(), props);
         } catch (Exception e) {
      Log.error("Error Setting JTattoo ", e);
         }

 //JTattoo
  "com.jtattoo.plaf.acryl.AcrylLookAndFeel",
  "com.jtattoo.plaf.aero.AeroLookAndFeel",
  "com.jtattoo.plaf.aluminium.AluminiumLookAndFeel",
  "com.jtattoo.plaf.bernstein.BernsteinLookAndFeel",
  "com.jtattoo.plaf.fast.FastLookAndFeel",
  "com.jtattoo.plaf.graphite.GraphiteLookAndFeel",
  "com.jtattoo.plaf.hifi.HiFiLookAndFeel",
  "com.jtattoo.plaf.luna.LunaLookAndFeel",
  "com.jtattoo.plaf.mcwin.McWinLookAndFeel",
  "com.jtattoo.plaf.mint.MintLookAndFeel",
  "com.jtattoo.plaf.noire.NoireLookAndFeel",
  "com.jtattoo.plaf.smart.SmartLookAndFeel",
     

给我留言

您必须 [ 登录 ] 才能发表留言!

×