在ECLIPSE中,如何使用substance.jar来改变application的界面皮肤?
2个回答
2016-02-09 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
1.下载substance.jar
现在最新的版本已经出到4.3了,而且更新很快
2.将substance.jar添加到类路径中
3.将下列代码添加到程序的主执行类的main()方法中:
try {
UIManager.setLookAndFeel(new SubstanceLookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
// SubstanceLookAndFeel.setSkin(new EmeraldDuskSkin());
// SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper());
// SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark());
// SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter());
// SubstanceLookAndFeel.setCurrentGradientPainter(new StandardGradientPainter());
// SubstanceLookAndFeel.setCurrentTitlePainter(new FlatTitePainter());
} catch (Exception e) {
System.err.println("Something went wrong!");
}
展开全部
Substance 这个项目的目的是提供一个流行的外观(look & feel)。这个外观(look & feel)联合了Windows XP和MacOS 10.4最好的特性并且需要JDK 5.0以上 将下列jar文件拷贝到你的程序的classpath中,然后将下列代码段加入到你main函数中 http://l1.edn.cn/cache/http/index.php?q=http%3A%2F%2F210.42.106.102%2Fbbs%2Fviewthread.php%3Ftid%3D111%26amp%3Bextra%3Dpage%253D1 (注,其实我在别的文章中给出了一个例子,参见用java打造任意形状窗口一文中的的代码) 1.substance look and feel: try { UIManager.setLookAndFeel(new SubstanceLookAndFeel()); UIManager.put("swing.boldMetal", false); if (System.getProperty("substancelaf.useDecorations") == null) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } System.setProperty("sun.awt.noerasebackground", "true"); SubstanceLookAndFeel.setCurrentTheme(new SubstanceLightAquaTheme());//设置当前的主题风格,同样我 们还可以设置当前的按钮形状,水印风格等等 } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 2.smooth look and feel try { UIManager.setLookAndFeel(new SmoothLookAndFeel()); UIManager.put("swing.boldMetal", false); } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 3. office/winxp/VisualStudio 2005 look and feel try { UIManager.setLookAndFeel("org.fife.plaf.Office2003.Office2003LookAndFeel"); //UIManager.setLookAndFeel("org.fife.plaf.OfficeXP.OfficeXPLookAndFeel"); //UIManager.setLookAndFeel("org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel"); UIManager.put("swing.boldMetal", false); } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 查看原帖>>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询