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