1

I am trying to use the Sea Glass LAF for a Java application but it gives the Class Not Found Exception (in Windows using JDK 8). I added the seaglass-0.1.7.3 jar file to the libraries folder and added it to build path. I also added import com.seaglasslookandfeel.*; to the code but it is shown as an unused import.

Below is my code:

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:

How can I solve this and use Seaglass? Any help is much appreciated.

Fleur
  • 666
  • 1
  • 8
  • 29

3 Answers3

2

It appears to be the case that the SynthUI pluggable-look-and-feel classes (on which the Sea Glass LAF depends) were migrated from the sun.* package space into javax.* as of Java 7. As mentioned in a comment by @aurelianr, a newer Sea Glass JAR that has been compiled against JDK >= 7 should fix your issue.

thewmo
  • 755
  • 5
  • 7
1

I tried the following code and it works fine. I downloaded the seaglass jar from this link: 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();
                    }
                }
            } );
        }


}
aurelianr
  • 538
  • 2
  • 12
  • 35
  • I tested the above code with seaglass 0.1.7.3 from here http://www.java2s.com/Code/Jar/s/Downloadseaglasslookandfeel02jar.htm and I encountered the same error as you. Try do download the 0.2 seaglass jar version and it will work. – aurelianr Aug 01 '16 at 14:25
  • Changing the jar version solved it, thanks :) However unfortunately card panels do not work well when Sea Glass is used. – Fleur Aug 02 '16 at 09:55
0

@thewmo and @aurelianr are right. You may find the newest version here: https://mvnrepository.com/artifact/com.seaglasslookandfeel/seaglasslookandfeel

If you want to do it using Maven or simple downloading the jar file

Benjamin RD
  • 11,516
  • 14
  • 87
  • 157
  • 1
    I downloaded 0.2.1 from this link, and still get NoClassDefFound on sun/swing/plaf/synth/SynthIcon. Any thoughts? – Bill Evans May 01 '20 at 00:43