加载皮肤时出现异常

时间:2011-02-21 05:01:55

标签: java exception skinlookandfeel

我正在使用SkinLookAndFeel,并希望使用SkinLookAndFeel的aquathememee。我已经下载了sklf.jar和aquathemepack.zip。这是我的代码:

        Skin skin = SkinLookAndFeel.loadSkin("aquathemepack.zip");
        SkinLookAndFeel.setSkin(skin);
        UIManager.setLookAndFeel(new SkinLookAndFeel());

,例外是:

java.lang.Exception: Unable to load this skin file:/C:/Workspaces/Demo_Swing/Demo/aquathemepack.zip (by using filename matching),  try an explicit constructor
    at com.l2fprod.gui.plaf.skin.SkinLookAndFeel.loadSkin(SkinLookAndFeel.java:902)
    at com.l2fprod.gui.plaf.skin.SkinLookAndFeel.loadSkin(SkinLookAndFeel.java:883)
    at com.talk.Atalk.<init>(Atalk.java:139)
    at com.talk.Atalk.main(Atalk.java:1214)

为什么我收到此错误?我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

SkinLookAndFeel.loadSkin(String)方法需要一个以“gtkrc”或“.themerc”结尾的文件名。源代码是here ...你想看看。

答案 1 :(得分:0)

好的,我已经解决了。

我没有使用loadSkin()而是使用loadThemePack(),而且一切正常。