1 36 37 40 41 import java.awt.*; 42 import java.beans.*; 43 import java.awt.event.*; 44 import javax.swing.*; 45 import javax.swing.event.*; 46 47 48 54 public class UISwitchListener implements PropertyChangeListener { 55 JComponent componentToSwitch; 56 57 public UISwitchListener(JComponent c) { 58 componentToSwitch = c; 59 } 60 61 public void propertyChange(PropertyChangeEvent e) { 62 String name = e.getPropertyName(); 63 if (name.equals("lookAndFeel")) { 64 SwingUtilities.updateComponentTreeUI(componentToSwitch); 65 componentToSwitch.invalidate(); 66 componentToSwitch.validate(); 67 componentToSwitch.repaint(); 68 } 69 } 70 } 71 | Popular Tags |