I wrote:
> > 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);
> >       }
> >     }

Armond Avanes wrote:

> 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 ?

In fact, the "Classloader" property in not always reconized (I mean used
by Swing). If not, an other solution is to preload the UI classes. Only
one of these solutions should be needed for a given JDK. But I can not
tell you which JDK uses the LookAndFeel classloader, which one reconized
the "Classloader" property and which needs the preload section. The only
thing quite sure is that only JDK 1.2.0 needs the lookandfeel archive to
be in the bootclasspath.

Regards, Guillaume Desnoix
--
Author of SLAF, the simple look and feel
http://www.memoire.com/guillaume-desnoix/slaf/
(new release and themes soon available)
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to