﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-学习</title><link>http://www.blogjava.net/yangyanghety83/</link><description>努力</description><language>zh-cn</language><lastBuildDate>Thu, 07 May 2026 07:36:45 GMT</lastBuildDate><pubDate>Thu, 07 May 2026 07:36:45 GMT</pubDate><ttl>60</ttl><item><title>简单的界面换肤术</title><link>http://www.blogjava.net/yangyanghety83/archive/2008/05/29/203895.html</link><dc:creator>杨</dc:creator><author>杨</author><pubDate>Thu, 29 May 2008 09:40:00 GMT</pubDate><guid>http://www.blogjava.net/yangyanghety83/archive/2008/05/29/203895.html</guid><wfw:comment>http://www.blogjava.net/yangyanghety83/comments/203895.html</wfw:comment><comments>http://www.blogjava.net/yangyanghety83/archive/2008/05/29/203895.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/yangyanghety83/comments/commentRss/203895.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/yangyanghety83/services/trackbacks/203895.html</trackback:ping><description><![CDATA[<div id="articledot">
<pre>1：可以直接在程序中调用下面三个中的一个：
import javax.swing.*;
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel") ;
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") ;
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel") ;
2：或采用菜单来变换：
import javax.swing.*;
JMenuBar mb = new JMenuBar();
JMenu file = new JMenu("Look &amp; Feel", true);
ButtonGroup buttonGroup = new ButtonGroup();
final UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
for (int i = 0; i &lt; info.length; i++) {
JRadioButtonMenuItem item = new
JRadioButtonMenuItem(info[i].getName(), i == 0);
final String className = info[i].getClassName();
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try { UIManager.setLookAndFeel(className); }
catch (Exception e) { System.out.println(e); }
SwingUtilities.updateComponentTreeUI(TouchyFeely.this); }
});
buttonGroup.add(item);
file.add(item);
}
mb.add(file);
setJMenuBar(mb);
}
</pre>
<p>&nbsp;</p>
</div>
<div id="articlebody">1：可以直接在程序中调用下面三个中的一个： import javax.swing.*; UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel") ; UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") ; UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel") ; 2：或采用菜单来变换： import javax.swing.*; JMenuBar mb = new JMenuBar(); JMenu file = new JMenu("Look &amp; Feel", true); ButtonGroup buttonGroup = new ButtonGroup(); final UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels(); for (int i = 0; i &lt; info.length; i++) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(info[i].getName(), i == 0); final String className = info[i].getClassName(); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { try { UIManager.setLookAndFeel(className); } catch (Exception e) { System.out.println(e); } SwingUtilities.updateComponentTreeUI(TouchyFeely.this); } }); buttonGroup.add(item); file.add(item); } mb.add(file); setJMenuBar(mb); } </div>
<img src ="http://www.blogjava.net/yangyanghety83/aggbug/203895.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/yangyanghety83/" target="_blank">杨</a> 2008-05-29 17:40 <a href="http://www.blogjava.net/yangyanghety83/archive/2008/05/29/203895.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>