1. /*
  2. * @(#)MetalCheckBoxUI.java 1.13 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 javax.swing.plaf.metal;
  8. import javax.swing.*;
  9. import javax.swing.plaf.basic.BasicCheckBoxUI;
  10. import java.awt.*;
  11. import java.awt.event.*;
  12. import javax.swing.plaf.*;
  13. import java.io.Serializable;
  14. /**
  15. * CheckboxUI implementation for MetalCheckboxUI
  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.13 11/29/01
  25. * @author Michael C. Albers
  26. *
  27. */
  28. public class MetalCheckBoxUI extends MetalRadioButtonUI {
  29. // NOTE: MetalCheckBoxUI inherts from MetalRadioButtonUI instead
  30. // of BasicCheckBoxUI because we want to pick up all the
  31. // painting changes made in MetalRadioButtonUI.
  32. private final static MetalCheckBoxUI checkboxUI = new MetalCheckBoxUI();
  33. private final static String propertyPrefix = "CheckBox" + ".";
  34. private boolean defaults_initialized = false;
  35. // ********************************
  36. // Create PlAF
  37. // ********************************
  38. public static ComponentUI createUI(JComponent b) {
  39. return checkboxUI;
  40. }
  41. public String getPropertyPrefix() {
  42. return propertyPrefix;
  43. }
  44. // ********************************
  45. // Defaults
  46. // ********************************
  47. public void installDefaults(AbstractButton b) {
  48. super.installDefaults(b);
  49. if(!defaults_initialized) {
  50. icon = UIManager.getIcon(getPropertyPrefix() + "icon");
  51. defaults_initialized = true;
  52. }
  53. }
  54. protected void uninstallDefaults(AbstractButton b) {
  55. super.uninstallDefaults(b);
  56. defaults_initialized = false;
  57. }
  58. }