【转】JTattoo下载及使用方法
很好用的swing皮肤包,官方网站http://www.jtattoo.net/Download.html
使用方法如下(例子来自官网):
改变你的swing程序皮肤的最简单的方法,将JTattoo.jar添加到classpath中(如果用eclipse或NetBeans则导入到工程使用的库中),然后在主函数中添加一句语句,再捕获异常即可。下面是例子:
/*
* Copyright 2005 MH-Software-Entwicklung. All rights reserved.
* Use is subject to license terms.
*/
package com.jtattoo.demo.app;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MinFrame extends JFrame {
public MinFrame() {
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(下面就是要改变的地方了)
JFrame.setDefaultLookAndFeelDecorated(true);
UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");
---------------------------------- start application
new MinFrame();
}
catch (Exception ex) {
ex.printStackTrace();
}
} // end main
} // end class MinFrame
-----------------------------------------------------------------------------------------------------------------------------------
皮肤参数(将下面其中的一个替换上面例程中主函数try块的UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");中相应的代码即可换肤).
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纯风格