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