01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.plaf.jfc;
06:
07: import java.beans.*;
08: import javax.swing.*;
09:
10: import com.javelin.swinglets.*;
11: import com.javelin.swinglets.plaf.*;
12:
13: /**
14: * JFCLabelUI defines a look and feel for default Swing.
15: *
16: * @author Robin Sharp
17: */
18:
19: public class JFCLabelUI extends JFCComponentUI {
20: /**
21: * Construct a JFCLabelUI, and construct a JLabel internally.
22: */
23: public JFCLabelUI() {
24: super (new JLabel());
25: }
26:
27: /**
28: * Construct a JFCLabelUI, with a JLabel.
29: */
30: public JFCLabelUI(JLabel label) {
31: super (label);
32: }
33:
34: /**
35: * Listen for changes in the SLabel and mirror them in the component
36: */
37: public void propertyChange(PropertyChangeEvent event) {
38: if ("text".equals(event.getPropertyName()))
39: ((JLabel) component).setText((String) event.getNewValue());
40: else if ("icon".equals(event.getPropertyName())) {
41: if (event.getNewValue() != null) {
42: ((JLabel) component).setIcon(new ImageIcon(
43: ((SIcon) event.getNewValue()).getImage()));
44: } else {
45: ((JLabel) component).setIcon(null);
46: }
47: } else
48: super.propertyChange(event);
49: }
50: }
|