我在网上下载了很多Java 皮肤,都不知道怎么用啊,都说把代码拷贝到main函数的第一行,但还是不一可以,告诉帮忙看看
package Cffx;import java.awt.*;
import java.awt.event.*;import javax.swing.*;import com.birosoft.liquid.LiquidListUI;public class Denglu extends JFrame {
private JLabel l1,l2;
private JTextField t1;
private JPasswordField t2;
private JButton b1,b2;
public Denglu()
{  MyLookAndFeel.setLookAndFeel(MyLookAndFeel.liquidinf);
super.setTitle("登陆窗口");
super.setSize(600,400);
Container c=getContentPane();
c.setLayout(new FlowLayout());
l1=new JLabel("用户名:");
c.add(l1);
t1=new JTextField(10);
c.add(t1);
l2=new JLabel("密码:");
c.add(l2);
t2=new JPasswordField(10);
c.add(t2);
b1=new JButton("确定");
c.add(b1);
b2=new JButton("取消");
c.add(b2);




super.setVisible(true);
}
public static void main(String[] args) {
MyLookAndFeel.setLookAndFeel(MyLookAndFeel.liquidinf);//这个类可以把皮肤加载过来
Denglu dl=new Denglu();
dl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 MyLookAndFeel.setLookAndFeel(MyLookAndFeel.liquidinf); }

}
java皮肤,UI

解决方案 »

  1.   


    同求,最近也想用java皮肤
      

  2.   

    UIManager被我封装在类里面了
    package Cffx;import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    public class MyLookAndFeel {
    //在界面内直接掉就可以实现皮肤效果
    //系统自带皮肤,5中都能用
    public static String sys_Metal = "javax.swing.plaf.metal.MetalLookAndFeel"; 
    public static String sys_Nimbus = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
    public static String sys_CDE_Motif = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
    public static String sys_Windows = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    public static String sys_Windows_Classic = "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel";
    //JIattoo jar包资源
    public static String jtattoo_acryl = "com.jtattoo.plaf.acryl.AcrylLookAndFeel";
    public static String jtattoo_aero = "com.jtattoo.plaf.aero.AeroLookAndFeel";
    public static String jtattoo_aluminum = "com.jtattoo.plaf.aluminium.AluminiumLookAndFeel";
    public static String jtattoo_bernstein = "com.jtattoo.plaf.bernstein.BernsteinLookAndFeel";
    public static String jtattoo_fast = "com.jtattoo.plaf.fast.FastLookAndFeel";
    public static String jtattoo_hifi = "com.jtattoo.plaf.hifi.HiFiLookAndFeel";
    public static String jtattoo_luna = "com.jtattoo.plaf.luna.LunaLookAndFeel";
    public static String jtattoo_mcwin = "com.jtattoo.plaf.mcwin.McWinLookAndFeel";
    public static String jtattoo_mint = "com.jtattoo.plaf.mint.MintLookAndFeel";
    public static String jtattoo_noire = "com.jtattoo.plaf.noire.NoireLookAndFeel";
    public static String jtattoo_smart = "com.jtattoo.plaf.smart.SmartLookAndFeel";
    //liquidlnf.jar包资源
    public static String liquidinf= "com.birosoft.liquid.LiquidLookAndFeel";
    //SwingSet2_zip.jar包资源  苹果皮肤 咋不太好看
    public static String SwingSet_borland= "com.borland.plaf.borland.BorlandLookAndFeel";
    public static String SwingSet_quaqua1= "ch.randelshofer.quaqua.Quaqua13PantherLookAndFeel";
            public static String SwingSet_quaqua2= "ch.randelshofer.quaqua.QuaquaLookAndFeel";
            public static String SwingSet_Office2003= "org.fife.plaf.Office2003.Office2003LookAndFeel";
    public static String SwingSet_OfficeXP= "org.fife.plaf.OfficeXP.OfficeXPLookAndFeel";
    public MyLookAndFeel(){

    }

    public static void setLookAndFeel(String skin){
    try {
    UIManager.setLookAndFeel(skin);
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (InstantiationException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
    e.printStackTrace();
    }
    }
    }
      

  3.   

    抛异常没?
    观感的jar文件加到classpath没?