Java Look And Feel

imported_Ned Flanders

Senior member
May 11, 2005
641
0
0
Ok, so I want to make an application of mine themable. I'm kind of cheating and trying to use 3rd Party Java Look And Feel .jars

So,

I first list all the files in the 'theme' dir
I loop the listed files for ones which end in ".jar"
I create a JarFile object for any Jar Files which are found
For each JarFile I loop through all the files looking for ones which end in "LookAndFeel.class"
If found, I create a URLClassLoader object using the JarFile URL
Then (after converting the LookAndFeel class file into a Class name (i.e net/lookandfeel/LookAndFeel.class becomes net.lookandfeel.LookAndFeel) I try and apply the them via UIManager.setLookAndFeel(className);

It doesn't work! I get fileNotFoundExceptions for some of the support files, other times ClassNotFoundExceptions

Any help would be great
 

imported_Ned Flanders

Senior member
May 11, 2005
641
0
0
Ok, I found the solution: UIManager.getDefaults().put("ClassLoader", <LookAndFeelClass's Class Loader>);

Sun neglected to document this! :mad: