Search code examples
javaswinglook-and-feel

Napkin custom LookAndFeel in Eclipse


Premise

I'm pretty new to GUI programming but I'm looking for a way to put the Napkin Look and feel onto my application though Eclipse.

What I've done thus far

I've had a look around and from what I can see I need to put the napkin .jar's into my buildpath. I've tried to do this by right-clicking in the navigator and selecting import --> File system and highlighting the .jars associated with Napkin.

Inside of my Main I've added the following code:

try{
    UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
}catch(Exception e){
    e.printStackTrace();
}

Which I believe should apply the Napkin Look and Feel, unfortunately, I keep getting this error:

java.lang.ClassNotFoundException: net.sourceforge.napkinlaf.NapkinLookAndFeel
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
    at javax.swing.UIManager.setLookAndFeel(Unknown Source)
    at yulfy.alterd.FrameTest.main(FrameTest.java:8)

Question

What on earth am I doing wrong? (I'm sorry if it's terribly obvious!)

Thanks for your time!

Links

Napkin site: http://napkinlaf.sourceforge.net/

Notes

  • It seems that the latest is 1.2 and not alpha001 which is the first file available on Sourceforge.

  • If any further clarification/information is needed, don't hesitate to post.


Solution

  • right click over your project, go to build path, click on "add external jar" and select the jar