Dear Friend,
> I think Andrew is right: UI classes are not retrieved. But there can be
> many reasons.
>
> 1) I don't think it is your case, but JDK1.2.0 can use swing lnf only if
> they are in the bootclasspath. Fortunately it doesn't concern JDK1.1 nor
> JDK1.2.2 and JDK1.3.
I'm using JDK 1.3 here (althought I want my application to work on whole the
Java 2 platforms - 1.2+ )
> 2) The UI classes are (in many LNFs) registrered by their string names
> in the UIDefaults Hashtable. It means that there is no reference to the
> UI classes in the LookAndFeel class. So they are not downloaded neither
> resolved.
That's okay. But what is happened in the background when those classes are
really needed ?
Are they loaded by the same classloader which has loaded the LookAndFeel
class or it has its own mechanism ?
> 3) When a JComponent needs an UI, it asks it to the UIManager but it
> used its class loader, not the LookAndFeel class loader. And the
> JComponent class loader is often local so it can not find the UI class.
> I think this is a registered bug and I don't know on which JDK is
> applied. A work-around is to register the classloader into the
> UIDefaults and eventually to preload the UI classes:
>
> ClassLoader cl=renderer_class.getClassLoader();
> Hashtable tb=UIManager.getDefaults();
>
> // regsiter the classloader
> tb.put("ClassLoader",cl);
>
> // preload
> Enumeration e=tb.keys();
> while(e.hasMoreElements())
> {
> String k=(String)e.nextElement();
>
> if(k.endsWith("UI"))
> {
> Class uic=cl.loadClass((String)tb.get(k));
> tb.put(uic.getName(),uic);
> }
> }
Thanks for your solution :) Let me test it and will let you know whether
I've been successful or not.
But before I test it, I woudl like to know whether the "preload" section is
really needed ? You've already registered your custom classloader!
Why should I have a "preload" section too ?
> Maybe there is something to do with the resources also.
> Hope it helps. Tell me if there is something to patch in Slaf.
I don't think so because it's general problem among all the look&feels and
not a SLAF specific problem. Thanks for your concern.
> Regards, Guillaume Desnoix
> --
> Author of SLAF, the simple look and feel
> http://www.memoire.com/guillaume-desnoix/slaf/
> (new release and themes soon available)
Thanks again for your time,
Armond
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing