用各种look and feel打造swing界面
虽然我们知道,一个桌面应用程序的好坏,和它的性能,功能有着很大关系,然而,对于大多数坐在电脑前的用户而言,他们的标准往往是: 绚丽的外观 MVC设计下的的SWING自然没有忽视这一点,通过对UIManager的设置,我们可以很容易的改变应用程序的外观,也就是LOOK AND FEEL
一.如何设置look and feel:
改变外观,似乎是一个很麻烦的事情,幸运的是在swing里,我们只需要简单的一行代码就可以改变
UIManager.setLookAndFeel(new LookAndFeel());
比如:
UIManager.setLookAndFeel(new QuaquaLookAndFeel());
我们还可以通过
UIManager.setLookAndFeel(String s);
来改变外观,其中,s是表示该外观的路径,比如
UIManager.setLookAndFeel(
"org.fife.plaf.OfficeXP.OfficeXPLookAndFeel");
另外,如果该Look And Feel类对窗口的边框还有修饰的话,还可以通过
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
这样一来,窗口就会采用该外观特制的边框
二.一些比较帅气的look and feel
swing自带提供了几种look and feel类,不过,这显然是不够的,下面,就让我们看看第三方都提供了些什么酷酷的外观咯:
1.Substance
这个项目的目的是提供一个流行的外观(look & feel)。这个外观(look & feel)联合了Windows XP和MacOS 10.4最好的特性并且需要JDK 5.0以上。
将窗口的边框替换成Substance特定边框后,我们还可以通过点击其左上角的小方块来手工配制其外观,可以配制的有
主题,水印,按钮形状,渐变情况,看,这个蝴蝶形状的button多酷!
2.Smooth
提供了改进型的windows和metal风格的外观风格
提供了仿照Xp,Office2003和VS的外观风格
.其他
在网站上罗列如今较为流行的外观类,大家有兴趣可以去研究一下咯^_^
http://www.open-open.com/61.htm
三.使用方法
将下列jar文件拷贝到你的程序的classpath中,然后将下列代码段加入到你main函数中
(注,其实我在别的文章中给出了一个例子,http://210.42.106.102/bbs/viewth ... &extra=page%3D1,
参见用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!");
}
分享到:
相关推荐
使用lookandfeel为界面更换皮肤
java中MVC与LookAndFeel类及自创界面
java中MVC与LookAndFeel类及自创界面(更新)
java Look and feel的一些例子,改变swing界面
a03LooKAndFeel皮肤,超炫超酷
java look and feel相当完整资料 通俗易懂
有以下十种风格可以设置: javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel"); javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel"); ...
java swing 中通过UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel()); JFrame.setDefaultLookAndFeelDecorated(true); //设置主题 SubstanceLookAndFeel.setCurrentTheme(new ...
超级漂亮的LookAndFeel超
源码+直接运行的 jar文件 希望大家得到福利后 评论下
LOOkAndFeel是你的JAVa界面更加绚丽多彩
swing 的各种look and feel.让你的java桌面程序有个性。 window风格,苹果风格,3d风格等等,
Java Look and Feel Design Guidelines. JAVA界面设计技术(换肤术)
java swing Mac风格的LookAndFeel包,含使用说明和效果图,适合用来美化界面
很好用的很漂亮的一个lookandfeel(nimrod),可自定义色彩,控件样式。 (内附使用方法)
Quaqua Look and Feel (Quaqua)是一款为Mac OS X编写的Apple人性化界面向导(AHIG)。报道中指出,新版本中增加了调色盘和粉笔面板,改进了色彩精度。此外还修补了一些bug。
java 连接数据库 lookandfeel java网络编程 java 连接3大数据库,各种风格的窗口主题,C/S版的java网络编程 java 举例(源代码)
可以工作在中文环境下的jgoodies look and feel。jgoodies官方提供的包在中文环境下是没法运行的,都是乱码。我修改了源码,可以在中文环境下正常显示中文。
Java Look and Feel Design Guidelines Advanced Topics provides advanced design guidelines for user interfaces based on the Java Foundation Classes (JFC) with the Java look and feel. This book augments ...
java swing Mac风格的look and feel包,美化程序界面,含有使用说明和效果图,不好意思,这个上传时选错了文件,哈哈,不要下载了,正确的文件查另一个我的上传