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