1. /*
  2. * @(#)MotifRadioButtonUI.java 1.17 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.java.swing.plaf.motif;
  8. import javax.swing.*;
  9. import javax.swing.border.*;
  10. import javax.swing.plaf.basic.BasicRadioButtonUI;
  11. import javax.swing.plaf.basic.BasicGraphicsUtils;
  12. import javax.swing.plaf.*;
  13. import java.awt.*;
  14. /**
  15. * RadioButtonUI implementation for MotifRadioButtonUI
  16. * <p>
  17. * <strong>Warning:</strong>
  18. * Serialized objects of this class will not be compatible with
  19. * future Swing releases. The current serialization support is appropriate
  20. * for short term storage or RMI between applications running the same
  21. * version of Swing. A future release of Swing will provide support for
  22. * long term persistence.
  23. *
  24. * @version 1.17 11/29/01
  25. * @author Rich Schiavi
  26. */
  27. public class MotifRadioButtonUI extends BasicRadioButtonUI {
  28. private static final MotifRadioButtonUI motifRadioButtonUI = new MotifRadioButtonUI();
  29. protected Color focusColor;
  30. private boolean defaults_initialized = false;
  31. // ********************************
  32. // Create PLAF
  33. // ********************************
  34. public static ComponentUI createUI(JComponent c) {
  35. return motifRadioButtonUI;
  36. }
  37. // ********************************
  38. // Install Defaults
  39. // ********************************
  40. public void installDefaults(AbstractButton b) {
  41. super.installDefaults(b);
  42. if(!defaults_initialized) {
  43. focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
  44. defaults_initialized = true;
  45. }
  46. }
  47. protected void uninstallDefaults(AbstractButton b) {
  48. super.uninstallDefaults(b);
  49. defaults_initialized = false;
  50. }
  51. // ********************************
  52. // Default Accessors
  53. // ********************************
  54. protected Color getFocusColor() {
  55. return focusColor;
  56. }
  57. // ********************************
  58. // Paint Methods
  59. // ********************************
  60. protected void paintFocus(Graphics g, Rectangle t, Dimension d){
  61. g.setColor(getFocusColor());
  62. g.drawRect(0,0,d.width-1,d.height-1);
  63. }
  64. }