uninitialize() does not "seem" to undo the processing
for buttons.
To test this:
1. In a running application set the look and feel
to Napkin LAF.
2. Then set to CrossPlatform LAF (or System LAF).
3. Update UI.
4. All display switches to CrossPlatform LAF
except the LINE borders on buttons.
Sample code to test:
The following code can be added to a panel
which has three buttons. The buttons activate each of
the three _actionPerformed() methods:
public void btnToolBarNapkinLAF_actionPerformed
(ActionEvent e)
{
if (_napkinLAF == null)
_napkinLAF = new
net.sourceforge.napkinlaf.NapkinLookAndFeel();
try {
UIManager.setLookAndFeel(_napkinLAF);
updateDisplay();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void btnToolBarSystemLAF_actionPerformed
(ActionEvent e)
{
try {
UIManager.setLookAndFeel
(UIManager.getSystemLookAndFeelClassName());
updateDisplay();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void
btnToolBarCrossPlatformLAF_actionPerformed(ActionEvent
e)
{
try {
UIManager.setLookAndFeel
(UIManager.getCrossPlatformLookAndFeelClassName());
updateDisplay();
} catch (Exception ex) {
ex.printStackTrace();
}
}
protected void updateDisplay()
{
Window window = getTopmostWindow();
if (window == null)
SwingUtilities.updateComponentTreeUI(this);
else
updateLookAndFeelOfChildWindows(window);
}
public Window getTopmostWindow()
{
Container comp = this;
for (int i = 0; i < 100 ; i++)
{
Container parentComp = comp.getParent();
if (parentComp == null)
return null;
if (parentComp instanceof Window)
return (Window)parentComp;
comp = parentComp;
}
return null;
}
/**
* @param window a value of type 'Window'
*/
protected void updateLookAndFeelOfChildWindows
(Window window)
{
SwingUtilities.updateComponentTreeUI(window);
Window children[] = window.getOwnedWindows();
for (int i = 0; i < children.length; i++) {
updateLookAndFeelOfChildWindows(children
[i]);
}
}
Logged In: NO
Obviously we'll look into it, but it is officially not a goal for the pluggable LAF framework
to be able to do this kind of switching. The problem is that it is poorly defined what it
means to "put things back the way they were" when you uninstall a LAF, or what you can
assume (or not) when you install a LAF. So different LAFs assume different things and
they don't all work together all the time.
Again, we'll look at it, but it may have to be left.
(I know it's odd because it's demo'd all the time, but honestly, the spec isn't tight enough
to make it possible to make it work reliably.)