2016-08-01 15 views
1

我正在尝试将Sea Glass LAF用于Java应用程序,但它提供了类未找到异常(在使用JDK 8的Windows中)。我将seaglass-0.1.7.3 jar文件添加到库文件夹并将其添加到构建路径。我还在代码中添加了import com.seaglasslookandfeel.*;,但它显示为未使用的导入。无法使用Sea Glass LAF用于Java应用程序

下面是我的代码:

public static void main(String[] args) 
{ 
    EventQueue.invokeLater(new Runnable() 
    { 
     @Override 
     public void run() 
     { 
      try 
      { 
       UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel"); 
       setHomeWindow(new HomeWindow()); 
       window.getFrame().setVisible(true); 

      } 
      catch (Exception e) 
      { 
       e.printStackTrace(); 
      } 
     } 
    }); 
} 

Here is the stack trace:

我怎样才能解决这个问题,并使用SEAGLASS?任何帮助深表感谢。

回答

0

我试过下面的代码,它工作正常。我下载了SEAGLASS罐子从这个链接:http://www.java2s.com/Code/Jar/s/Downloadseaglasslookandfeel02jar.htm

import java.awt.EventQueue; 

import javax.swing.JFrame; 
import javax.swing.UIManager; 

public class HomeWindow extends JFrame{ 

    public HomeWindow() { 
     setTitle("look and feel demo"); 
     setSize(800, 600); 
     setVisible(true);  
    } 

     public static void main(String[] args) 
     { 
      EventQueue.invokeLater(new Runnable() 
      { 
       @Override 
       public void run() 
       { 
        try 
        { 
         UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel"); 
         new HomeWindow();      

        } 
        catch (Exception e) 
        { 
         e.printStackTrace(); 
        } 
       } 
      }); 
     } 


} 
+0

我使用seaglass 0.1.7.3从这里http://www.java2s.com/Code/Jar/s/Downloadseaglasslookandfeel02jar.htm测试了上述代码,我遇到了和你一样的错误。尝试下载0.2 seaglass jar版本,它会工作。 – aurelianr

+0

更改jar版本解决了它,谢谢:)不幸的是,当使用Sea Glass时卡面板不能很好地工作。 – Fleur

0

这似乎是在SynthUI可插拔的外观和感觉类(其上海玻璃LAF依赖)从sun.*包装空间迁移的情况下,从Java 7开始到javax.*。正如@aurelianr发表的评论所述,已经针对JDK> = 7编译的新Sea Glass JAR应该解决您的问题。

相关问题