1. /*
  2. * @(#)UIResource.java 1.10 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 javax.swing.plaf;
  8. /**
  9. * This interface is used to mark objects created by ComponentUI delegates.
  10. * The <code>ComponentUI.installUI()</code> and
  11. * <code>ComponentUI.uninstallUI()</code> methods can use this interface
  12. * to decide if a properties value has been overridden. For example, the
  13. * JList cellRenderer property is initialized by BasicListUI.installUI(),
  14. * only if it's initial value is null:
  15. * <pre>
  16. * if (list.getCellRenderer() == null) {
  17. * list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
  18. * }
  19. * </pre>
  20. * At uninstallUI() time we reset the property to null if its value
  21. * is an instance of UIResource:
  22. * <pre>
  23. * if (list.getCellRenderer() instanceof UIResource) {
  24. * list.setCellRenderer(null);
  25. * }
  26. *</pre>
  27. * This pattern applies to all properties except the java.awt.Component
  28. * properties font, foreground, and background. If one of these
  29. * properties isn't initialized, or is explicitly set to null,
  30. * its container provides the value. For this reason the
  31. * <code>"== null"</code> is unreliable when installUI() is called
  32. * to dynamically change a components look and feel. So at installUI()
  33. * time we check to see if the current value is a UIResource:
  34. *<pre>
  35. * if (!(list.getFont() instanceof UIResource)) {
  36. * list.setFont(UIManager.getFont("List.font"));
  37. * }
  38. * </pre>
  39. *
  40. * @see ComponentUI
  41. * @version 1.10 12/19/03
  42. * @author Hans Muller
  43. *
  44. */
  45. public interface UIResource {
  46. }