KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > snow > lookandfeel > UISwitchListener


1 package snow.lookandfeel;
2
3
4 import java.awt.*;
5 import java.beans.*;
6 import java.awt.event.*;
7 import javax.swing.*;
8 import javax.swing.event.*;
9
10
11 /**
12   * This class listens for UISwitches, and updates a given component.
13   *
14   * @version 1.4 04/23/99
15   * @author Steve Wilson
16   */

17 public final class UISwitchListener implements PropertyChangeListener
18 {
19
20     private JComponent componentToSwitch;
21
22     public UISwitchListener(JComponent c)
23     {
24        componentToSwitch = c;
25     }
26
27     public void propertyChange(PropertyChangeEvent e)
28     {
29        String JavaDoc name = e.getPropertyName();
30        if (name.equals("lookAndFeel"))
31        {
32           SwingUtilities.updateComponentTreeUI(componentToSwitch);
33           componentToSwitch.invalidate();
34           componentToSwitch.validate();
35           componentToSwitch.repaint();
36        }
37     }
38
39
40
41 } // UISwitchListener
42

43
44
45
46
47
48
49
50
Popular Tags