jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java
author peterz
Fri, 25 Dec 2009 17:47:08 +0300
changeset 4842 c9f791782a29
parent 4378 ef21a120cb18
child 5506 202f599c92aa
permissions -rw-r--r--
6860438: [Nimbus] Code to globally set slider's thumb background doesn't work as specified Reviewed-by: rupashka
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.swing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.Component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.Serializable;
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    37
import sun.swing.DefaultLookup;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Renders an item in a list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <strong><a name="override">Implementation Note:</a></strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * This class overrides
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <code>invalidate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <code>validate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <code>revalidate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <code>repaint</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <code>isOpaque</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <code>firePropertyChange</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * solely to improve performance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * If not overridden, these frequently called methods would execute code paths
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * that are unnecessary for the default list cell renderer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * If you write your own renderer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * take care to weigh the benefits and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * drawbacks of overriding these methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * @author Philip Milne
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * @author Hans Muller
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
public class DefaultListCellRenderer extends JLabel
4378
ef21a120cb18 6823603: Generics: JList
rupashka
parents: 2658
diff changeset
    74
    implements ListCellRenderer<Object>, Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    * An empty <code>Border</code>. This field might not be used. To change the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    * <code>Border</code> used by this renderer override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    * <code>getListCellRendererComponent</code> method and set the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    * of the returned component directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    84
    private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    85
    protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Constructs a default renderer object for an item
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * in a list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public DefaultListCellRenderer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        setOpaque(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        setBorder(getNoFocusBorder());
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    95
        setName("List.cellRenderer");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    98
    private Border getNoFocusBorder() {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    99
        Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        if (System.getSecurityManager() != null) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   101
            if (border != null) return border;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            return SAFE_NO_FOCUS_BORDER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        } else {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   104
            if (border != null &&
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   105
                    (noFocusBorder == null ||
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   106
                    noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   107
                return border;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   108
            }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   109
            return noFocusBorder;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public Component getListCellRendererComponent(
4378
ef21a120cb18 6823603: Generics: JList
rupashka
parents: 2658
diff changeset
   114
        JList<?> list,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        Object value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        int index,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        boolean isSelected,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        boolean cellHasFocus)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        setComponentOrientation(list.getComponentOrientation());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        Color bg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        Color fg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        JList.DropLocation dropLocation = list.getDropLocation();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        if (dropLocation != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                && !dropLocation.isInsert()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                && dropLocation.getIndex() == index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   130
            bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground");
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   131
            fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            isSelected = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            setBackground(bg == null ? list.getSelectionBackground() : bg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            setForeground(fg == null ? list.getSelectionForeground() : fg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            setBackground(list.getBackground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            setForeground(list.getForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        if (value instanceof Icon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            setIcon((Icon)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            setText("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            setIcon(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            setText((value == null) ? "" : value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        setEnabled(list.isEnabled());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        setFont(list.getFont());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        Border border = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        if (cellHasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            if (isSelected) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   160
                border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            if (border == null) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   163
                border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            border = getNoFocusBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        setBorder(border);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @return <code>true</code> if the background is completely opaque
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *         and differs from the JList's background;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   183
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public boolean isOpaque() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        Color back = getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        Component p = getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if (p != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            p = p.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        // p should now be the JList.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        boolean colorMatch = (back != null) && (p != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            back.equals(p.getBackground()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                        p.isOpaque();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        return !colorMatch && super.isOpaque();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   202
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    public void validate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   212
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public void invalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   222
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public void repaint() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   230
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    public void revalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   237
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    public void repaint(long tm, int x, int y, int width, int height) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   245
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public void repaint(Rectangle r) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   253
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        // Strings get interned...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        if (propertyName == "text"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                || ((propertyName == "font" || propertyName == "foreground")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                    && oldValue != newValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            super.firePropertyChange(propertyName, oldValue, newValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   270
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   278
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   286
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   294
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   302
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   310
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   318
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   326
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * A subclass of DefaultListCellRenderer that implements UIResource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * DefaultListCellRenderer doesn't implement UIResource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * directly so that applications can safely override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * cellRenderer property with DefaultListCellRenderer subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public static class UIResource extends DefaultListCellRenderer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        implements javax.swing.plaf.UIResource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
}