1. /*
  2. * @(#)WindowsRadioButtonUI.java 1.16 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package com.sun.java.swing.plaf.windows;
  11. import javax.swing.plaf.basic.*;
  12. import javax.swing.*;
  13. import javax.swing.plaf.*;
  14. import java.awt.*;
  15. /**
  16. * Windows rendition of the component.
  17. * <p>
  18. * <strong>Warning:</strong>
  19. * Serialized objects of this class will not be compatible with
  20. * future Swing releases. The current serialization support is appropriate
  21. * for short term storage or RMI between applications running the same
  22. * version of Swing. A future release of Swing will provide support for
  23. * long term persistence.
  24. */
  25. public class WindowsRadioButtonUI extends BasicRadioButtonUI
  26. {
  27. private static final WindowsRadioButtonUI windowsRadioButtonUI = new WindowsRadioButtonUI();
  28. protected int dashedRectGapX;
  29. protected int dashedRectGapY;
  30. protected int dashedRectGapWidth;
  31. protected int dashedRectGapHeight;
  32. protected Color focusColor;
  33. private boolean initialized = false;
  34. // ********************************
  35. // Create PLAF
  36. // ********************************
  37. public static ComponentUI createUI(JComponent c) {
  38. return windowsRadioButtonUI;
  39. }
  40. // ********************************
  41. // Defaults
  42. // ********************************
  43. public void installDefaults(AbstractButton b) {
  44. super.installDefaults(b);
  45. if(!initialized) {
  46. dashedRectGapX = ((Integer)UIManager.get("Button.dashedRectGapX")).intValue();
  47. dashedRectGapY = ((Integer)UIManager.get("Button.dashedRectGapY")).intValue();
  48. dashedRectGapWidth = ((Integer)UIManager.get("Button.dashedRectGapWidth")).intValue();
  49. dashedRectGapHeight = ((Integer)UIManager.get("Button.dashedRectGapHeight")).intValue();
  50. focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
  51. initialized = true;
  52. }
  53. }
  54. protected Color getFocusColor() {
  55. return focusColor;
  56. }
  57. // ********************************
  58. // Paint Methods
  59. // ********************************
  60. protected void paintFocus(Graphics g, Rectangle textRect, Dimension d){
  61. g.setColor(getFocusColor());
  62. BasicGraphicsUtils.drawDashedRect(g, textRect.x, textRect.y, textRect.width, textRect.height);
  63. }
  64. }