1. /*
  2. * @(#)WindowsCheckBoxUI.java 1.16 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.windows;
  8. import javax.swing.plaf.basic.*;
  9. import javax.swing.*;
  10. import javax.swing.plaf.*;
  11. import java.awt.*;
  12. /**
  13. * Windows check box.
  14. * <p>
  15. * <strong>Warning:</strong>
  16. * Serialized objects of this class will not be compatible with
  17. * future Swing releases. The current serialization support is appropriate
  18. * for short term storage or RMI between applications running the same
  19. * version of Swing. A future release of Swing will provide support for
  20. * long term persistence.
  21. *
  22. * @version 1.16 11/29/01
  23. * @author Jeff Dinkins
  24. */
  25. public class WindowsCheckBoxUI extends WindowsRadioButtonUI
  26. {
  27. // NOTE: MetalCheckBoxUI inherts from MetalRadioButtonUI instead
  28. // of BasicCheckBoxUI because we want to pick up all the
  29. // painting changes made in MetalRadioButtonUI.
  30. private static final WindowsCheckBoxUI windowsCheckBoxUI = new WindowsCheckBoxUI();
  31. private final static String propertyPrefix = "CheckBox" + ".";
  32. private boolean defaults_initialized = false;
  33. // ********************************
  34. // Create PLAF
  35. // ********************************
  36. public static ComponentUI createUI(JComponent c) {
  37. return windowsCheckBoxUI;
  38. }
  39. public String getPropertyPrefix() {
  40. return propertyPrefix;
  41. }
  42. // ********************************
  43. // Defaults
  44. // ********************************
  45. public void installDefaults(AbstractButton b) {
  46. super.installDefaults(b);
  47. if(!defaults_initialized) {
  48. icon = UIManager.getIcon(getPropertyPrefix() + "icon");
  49. defaults_initialized = true;
  50. }
  51. }
  52. public void uninstallDefaults(AbstractButton b) {
  53. super.uninstallDefaults(b);
  54. defaults_initialized = false;
  55. }
  56. }