Hi
I think that I got it... Could someone correct me if this is a crazy solution..
Code:
protected void doExecuteCommand() {
PlasticLookAndFeel.setMyCurrentTheme(theme);
try {
UIManager.setLookAndFeel(new PlasticXPLookAndFeel());
} catch (Exception e) {}
updateAllUIs();
}
and the updateAllUIs() is as follows:
Code:
/**
* Method to attempt a dynamic update for any GUI accessible by this JVM. It will
* filter through all frames and sub-components of the frames.
*/
public static void updateAllUIs()
{
Frame frames[];
int i1;
frames = Frame.getFrames();
i1 = 0;
for (int i = 0; i < frames.length; i++)
{
updateWindowUI(frames[i]);
}
}
/**
* Method to attempt a dynamic update for all components of the given <code>Window</code>.
* @param window The <code>Window</code> for which the look and feel update has to be performed against.
*/
public static void updateWindowUI(Window window)
{
try
{
updateComponentTreeUI(window);
}
catch(Exception exception) { }
Window windows[] = window.getOwnedWindows();
for (int i = 0; i < windows.length; i++)
updateWindowUI(windows[i]);
}
/**
* A simple minded look and feel change: ask each node in the tree
* to <code>updateUI()</code> -- that is, to initialize its UI property
* with the current look and feel.
*
* Based on the Sun SwingUtilities.updateComponentTreeUI, but ensures that
* the update happens on the components of a JToolbar before the JToolbar
* itself.
*/
public static void updateComponentTreeUI(Component c) {
updateComponentTreeUI0(c);
c.invalidate();
c.validate();
c.repaint();
}
private static void updateComponentTreeUI0(Component c) {
Component[] children = null;
if (c instanceof JToolBar)
{
children = ((JToolBar)c).getComponents();
if (children != null)
{
for(int i = 0; i < children.length; i++)
{
updateComponentTreeUI0(children[i]);
}
}
((JComponent) c).updateUI();
}
else
{
if (c instanceof JComponent) {
((JComponent) c).updateUI();
}
if (c instanceof JMenu) {
children = ((JMenu)c).getMenuComponents();
}
else if (c instanceof Container) {
children = ((Container)c).getComponents();
}
if (children != null)
{
for(int i = 0; i < children.length; i++)
{
updateComponentTreeUI0(children[i]);
}
}
}
}
Credit to "BigLee" for updateAllUIs() following a post on http://forum.java.sun.com/thread.jsp...sageID=3160062
However, you need to reset a LookAndFeel and then call the updateAllUIs()...
HTH,
Regards
Benoit