1. /*
  2. * @(#)MetalLabelUI.java 1.12 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.metal;
  8. import com.sun.java.swing.SwingUtilities2;
  9. import javax.swing.*;
  10. import javax.swing.plaf.*;
  11. import javax.swing.plaf.basic.*;
  12. import java.awt.*;
  13. /**
  14. * A Windows L&F implementation of LabelUI. This implementation
  15. * is completely static, i.e. there's only one UIView implementation
  16. * that's shared by all JLabel objects.
  17. *
  18. * @version 1.12 12/19/03
  19. * @author Hans Muller
  20. */
  21. public class MetalLabelUI extends BasicLabelUI
  22. {
  23. protected static MetalLabelUI metalLabelUI = new MetalLabelUI();
  24. public static ComponentUI createUI(JComponent c) {
  25. return metalLabelUI;
  26. }
  27. /**
  28. * Just paint the text gray (Label.disabledForeground) rather than
  29. * in the labels foreground color.
  30. *
  31. * @see #paint
  32. * @see #paintEnabledText
  33. */
  34. protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
  35. {
  36. int mnemIndex = l.getDisplayedMnemonicIndex();
  37. g.setColor(UIManager.getColor("Label.disabledForeground"));
  38. SwingUtilities2.drawStringUnderlineCharAt(l, g, s, mnemIndex,
  39. textX, textY);
  40. }
  41. }