01: package snow.lookandfeel;
02:
03: import java.awt.*;
04: import java.beans.*;
05: import java.awt.event.*;
06: import javax.swing.*;
07: import javax.swing.event.*;
08:
09: /**
10: * This class listens for UISwitches, and updates a given component.
11: *
12: * @version 1.4 04/23/99
13: * @author Steve Wilson
14: */
15: public class UISwitchListener implements PropertyChangeListener {
16:
17: private JComponent componentToSwitch;
18:
19: public UISwitchListener(JComponent c) {
20: componentToSwitch = c;
21: }
22:
23: public void propertyChange(PropertyChangeEvent e) {
24: String name = e.getPropertyName();
25: if (name.equals("lookAndFeel")) {
26: SwingUtilities.updateComponentTreeUI(componentToSwitch);
27: componentToSwitch.invalidate();
28: componentToSwitch.validate();
29: componentToSwitch.repaint();
30: }
31: }
32: }
|