01 /*
02 * Copyright 1997-1998 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.swing.plaf;
27
28 /**
29 * This interface is used to mark objects created by ComponentUI delegates.
30 * The <code>ComponentUI.installUI()</code> and
31 * <code>ComponentUI.uninstallUI()</code> methods can use this interface
32 * to decide if a properties value has been overridden. For example, the
33 * JList cellRenderer property is initialized by BasicListUI.installUI(),
34 * only if it's initial value is null:
35 * <pre>
36 * if (list.getCellRenderer() == null) {
37 * list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
38 * }
39 * </pre>
40 * At uninstallUI() time we reset the property to null if its value
41 * is an instance of UIResource:
42 * <pre>
43 * if (list.getCellRenderer() instanceof UIResource) {
44 * list.setCellRenderer(null);
45 * }
46 *</pre>
47 * This pattern applies to all properties except the java.awt.Component
48 * properties font, foreground, and background. If one of these
49 * properties isn't initialized, or is explicitly set to null,
50 * its container provides the value. For this reason the
51 * <code>"== null"</code> is unreliable when installUI() is called
52 * to dynamically change a components look and feel. So at installUI()
53 * time we check to see if the current value is a UIResource:
54 *<pre>
55 * if (!(list.getFont() instanceof UIResource)) {
56 * list.setFont(UIManager.getFont("List.font"));
57 * }
58 * </pre>
59 *
60 * @see ComponentUI
61 * @version 1.17 05/05/07
62 * @author Hans Muller
63 *
64 */
65
66 public interface UIResource {
67 }
|