home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / jfc.bin / UIResource.java < prev    next >
Text File  |  1998-02-26  |  2KB  |  64 lines

  1. /*
  2.  * @(#)UIResource.java    1.2 97/10/17
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf;
  22.  
  23.  
  24. /** 
  25.  * This interface is used to mark objects created by ComponentUI delegates.
  26.  * The <code>ComponentUI.installUI()</code> and 
  27.  * <code>ComponentUI.uninstallUI()</code> methods can use this interface
  28.  * to decide if a properties value has been overridden.  For example, the
  29.  * JList cellRenderer property is initialized by BasicListUI.installUI(),
  30.  * only if it's initial value is null:
  31.  * <pre>
  32.  * if (list.getCellRenderer() == null) {
  33.  *     list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
  34.  * }
  35.  * </pre>
  36.  * At uninstallUI() time we reset the property to null if its value
  37.  * is an instance of UIResource:
  38.  * <pre>
  39.  * if (list.getCellRenderer() instanceof UIResource) {
  40.  *     list.setCellRenderer(null);
  41.  * }
  42.  *</pre>
  43.  * This pattern applies to all properties except the java.awt.Component
  44.  * properties font, foreground, and background.  If one of these
  45.  * properties isn't initialized, or is explicitly set to null, 
  46.  * its container provides the value.  For this reason the 
  47.  * <code>"== null"</code> is unreliable when installUI() is called
  48.  * to dynamically change a components look and feel.  So at installUI() 
  49.  * time we check to see if the current value is a UIResource:
  50.  *<pre>
  51.  * if (!(list.getFont() instanceof UIResource)) {
  52.  *     list.setFont(UIManager.getFont("List.font"));
  53.  * }
  54.  * </pre>
  55.  *
  56.  * @see ComponentUI
  57.  * @version 1.2 10/17/97
  58.  * @author Hans Muller
  59.  * 
  60.  */
  61.  
  62. public interface UIResource {
  63. }
  64.