What is JTattoo?
JTattoo consists of several different Look and Feels for Swing applications. All of them enables developers to improve their application with an excellent user interface. So JTattoo opens desktop applications the door to end users who are unfortunate with the Look and Feels shipped with the standard JDK.
How to change the look of your application.
The following short code fragment shows you the way how to switch the Look and Feel in your application. Be sure that the JTattoo.jar is in the java classpath, if you want to run this demo. The easiest way is to copy the JTattoo.jar file into the (java_home)/jre/lib/ext folder.
首先在自己原有的程序里加载JTattoo包,右击自己的工程,选择最下面的Properties选项,蹦出如下对话框
选择JTattoo所在的路径并加入
package Demo;
//实例代码
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JTattooDemo extends JFrame {
public JTattooDemo() {
super("Minimal-Frame-Application");
// setup menu
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menu.setMnemonic('F');
JMenuItem menuItem = new JMenuItem("Exit");
menuItem.setMnemonic('x');
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, KeyEvent.ALT_MASK));
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
System.exit(0); } }); menu.add(menuItem); menuBar.add(menu); setJMenuBar(menuBar); // setup widgets
JPanel contentPanel = new JPanel(new BorderLayout());
contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4));
JScrollPane westPanel = new JScrollPane(new JTree());
JEditorPane editor = new JEditorPane("text/plain", "Hello World");
JScrollPane eastPanel = new JScrollPane(editor);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, westPanel,eastPanel);
splitPane.setDividerLocation(148);
contentPanel.add(splitPane, BorderLayout.CENTER);
setContentPane(contentPanel);
// add listeners
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// show application
setLocation(32, 32);
setSize(400, 300);
show();
} // end CTor MinFrame
public static void main(String[] args) {
try {
// select Look and Feel
UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");
// start application
new JTattooDemo();
}
catch (Exception ex) {
ex.printStackTrace();
}
} // end main
} // end class
附上可选皮肤参数
com.jtattoo.plaf.noire.NoireLookAndFeel 柔和黑
com.jtattoo.plaf.smart.SmartLookAndFeel 木质感+xp风格
com.jtattoo.plaf.mint.MintLookAndFeel 椭圆按钮+黄色按钮背景
com.jtattoo.plaf.mcwin.McWinLookAndFeel 椭圆按钮+绿色按钮背景
com.jtattoo.plaf.luna.LunaLookAndFeel 纯XP风格
com.jtattoo.plaf.hifi.HiFiLookAndFeel 黑色风格
com.jtattoo.plaf.fast.FastLookAndFeel 普通swing风格+蓝色边框
com.jtattoo.plaf.bernstein.BernsteinLookAndFeel 黄色风格
com.jtattoo.plaf.aluminium.AluminiumLookAndFeel 椭圆按钮+翠绿色按钮背景+金属质感
com.jtattoo.plaf.aero.AeroLookAndFeel xp清新风格
com.jtattoo.plafacryl.AcrylLookAndFeel 布质感+swing纯风格