1. /*
  2. * @(#)MetalLabelUI.java 1.10 03/01/23
  3. *
  4. * Copyright 2003 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 javax.swing.*;
  9. import javax.swing.plaf.*;
  10. import javax.swing.plaf.basic.*;
  11. import java.awt.*;
  12. /**
  13. * A Windows L&F implementation of LabelUI. This implementation
  14. * is completely static, i.e. there's only one UIView implementation
  15. * that's shared by all JLabel objects.
  16. *
  17. * @version 1.10 01/23/03
  18. * @author Hans Muller
  19. */
  20. public class MetalLabelUI extends BasicLabelUI
  21. {
  22. protected static MetalLabelUI metalLabelUI = new MetalLabelUI();
  23. public static ComponentUI createUI(JComponent c) {
  24. return metalLabelUI;
  25. }
  26. /**
  27. * Just paint the text gray (Label.disabledForeground) rather than
  28. * in the labels foreground color.
  29. *
  30. * @see #paint
  31. * @see #paintEnabledText
  32. */
  33. protected void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
  34. {
  35. int mnemIndex = l.getDisplayedMnemonicIndex();
  36. g.setColor(UIManager.getColor("Label.disabledForeground"));
  37. BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex,
  38. textX, textY);
  39. }
  40. }