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

下面是我的代码:

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();
            }
        }
    } );
}


java - 无法将Sea Glass LAF用于Java应用程序-LMLPHP

我该如何解决并使用Seaglass?任何帮助深表感谢。

最佳答案

我尝试了下面的代码,它工作正常。我从以下链接下载了Seaglass Jar: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();
                    }
                }
            } );
        }


}

09-25 20:26