50 |
import javax.swing.Icon; |
import javax.swing.Icon; |
51 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
52 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
53 |
|
import javax.swing.LookAndFeel; |
54 |
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
|
import javax.swing.UIDefaults; |
|
|
import javax.swing.UIManager; |
|
55 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
56 |
import javax.swing.plaf.LabelUI; |
import javax.swing.plaf.LabelUI; |
57 |
|
|
59 |
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI |
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI |
60 |
* object is used to paint all JLabels that utilize the Basic Look and Feel. |
* object is used to paint all JLabels that utilize the Basic Look and Feel. |
61 |
*/ |
*/ |
62 |
public class BasicLabelUI |
public class BasicLabelUI extends LabelUI implements PropertyChangeListener |
|
extends LabelUI |
|
|
implements PropertyChangeListener |
|
63 |
{ |
{ |
64 |
/** The labelUI that is shared by all labels. */ |
/** The labelUI that is shared by all labels. */ |
65 |
protected static BasicLabelUI labelUI; |
protected static BasicLabelUI labelUI; |
342 |
*/ |
*/ |
343 |
protected void installDefaults(JLabel c) |
protected void installDefaults(JLabel c) |
344 |
{ |
{ |
345 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground", |
346 |
|
"Label.font"); |
|
c.setForeground(defaults.getColor("Label.foreground")); |
|
|
c.setBackground(defaults.getColor("Label.background")); |
|
|
c.setFont(defaults.getFont("Label.font")); |
|
347 |
//XXX: There are properties we don't use called disabledForeground |
//XXX: There are properties we don't use called disabledForeground |
348 |
//and disabledShadow. |
//and disabledShadow. |
349 |
} |
} |
411 |
*/ |
*/ |
412 |
public void propertyChange(PropertyChangeEvent e) |
public void propertyChange(PropertyChangeEvent e) |
413 |
{ |
{ |
414 |
JLabel c = (JLabel) e.getSource(); |
// What to do here? |
|
c.revalidate(); |
|
|
c.repaint(); |
|
415 |
} |
} |
416 |
} |
} |