> UIManager.LookAndFeelInfo info = (UIManager.LookAndFeelInfo) rbmi2
> .getClientProperty ("lnf name");
> try
> {
> UIManager.setLookAndFeel (info.getClassName ());
> SwingUtilities.updateComponentTreeUI (mainWin);
UIManager is looking for a LookAndFeel class not a LookAndFeelInfo
one. That's possibly the cause of the problem,
Richard
Do - 19 Apr 2005 11:17 GMT
> > UIManager.LookAndFeelInfo info = (UIManager.LookAndFeelInfo) rbmi2
> > .getClientProperty ("lnf name");
[quoted text clipped - 7 lines]
>
> Richard
Hello Richard,
I use the LookAndFeelInfo for creating a menu to enable the selection
of all installed LookAndFeels. The strange thing is, that sometimes it
works fine, but sometimes, when I start the application in Windows
style and try to change in another style there occures this execption
in the TableHeader (WindowsTableHeaderUI$XPDefaultRenderer). I think
that the problem is not the way I set the look and feel
(UIManager.setLookAndFeel (info.getClassName () ), it must be
somethings else... It works fine, except the exception in the
TableHeader...
Following the source for the menu:
UIManager.LookAndFeelInfo[] lnfs = UIManager
.getInstalledLookAndFeels ();
for (int i = 0; i < lnfs.length; i++)
{
JRadioButtonMenuItem rbmi = new JRadioButtonMenuItem (lnfs[i]
.getName ());
lookFeelMenu.add (rbmi);
rbmi.setSelected (UIManager.getLookAndFeel ().getName ().equals
(
lnfs[i].getName ()));
rbmi.putClientProperty ("lnf name", lnfs[i]);
rbmi.addItemListener (new ItemListener ()
{
public void itemStateChanged (ItemEvent ie)
{
JRadioButtonMenuItem rbmi2 = (JRadioButtonMenuItem) ie
.getSource ();
if (rbmi2.isSelected ())
{
UIManager.LookAndFeelInfo info =
(UIManager.LookAndFeelInfo) rbmi2
.getClientProperty ("lnf name");
try
{
UIManager.setLookAndFeel (info.getClassName ().toString
());
SwingUtilities.updateComponentTreeUI (mainWin);
}
catch (Exception e)
{
System.err.println (e.getMessage ());
}
}
}
});
lnfGroup.add (rbmi);
}
Any suggestions for this problem?
Thanks a lot! Do