jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java
author malenkov
Wed, 30 Apr 2014 19:28:05 +0400
changeset 24544 c0133e7c7162
parent 22574 7f8ce0c8c20a
child 25201 4adc75e0c4e5
permissions -rw-r--r--
8041917: unexcepted behavior of LineBorder while using Boolean variable true Reviewed-by: alexsch, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
     2
 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
2
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4378
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4378
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4378
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4378
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4378
diff changeset
    23
 * questions.
2
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
20458
f2423fb3fd19 8025840: Fix all the doclint warnings about trademark
cl
parents: 5506
diff changeset
    66
 * of all JavaBeans&trade;
2
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
 */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
    73
@SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
public class DefaultListCellRenderer extends JLabel
4378
ef21a120cb18 6823603: Generics: JList
rupashka
parents: 2658
diff changeset
    75
    implements ListCellRenderer<Object>, Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    * An empty <code>Border</code>. This field might not be used. To change the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    * <code>Border</code> used by this renderer override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    * <code>getListCellRendererComponent</code> method and set the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    * of the returned component directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    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
    85
    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
    86
    protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * Constructs a default renderer object for an item
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * in a list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public DefaultListCellRenderer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        setOpaque(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        setBorder(getNoFocusBorder());
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    96
        setName("List.cellRenderer");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    99
    private Border getNoFocusBorder() {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   100
        Border border = DefaultLookup.getBorder(this, ui, "List.cellNoFocusBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        if (System.getSecurityManager() != null) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   102
            if (border != null) return border;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            return SAFE_NO_FOCUS_BORDER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        } else {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   105
            if (border != null &&
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   106
                    (noFocusBorder == null ||
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   107
                    noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   108
                return border;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   109
            }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   110
            return noFocusBorder;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    public Component getListCellRendererComponent(
4378
ef21a120cb18 6823603: Generics: JList
rupashka
parents: 2658
diff changeset
   115
        JList<?> list,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        Object value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        int index,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        boolean isSelected,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        boolean cellHasFocus)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        setComponentOrientation(list.getComponentOrientation());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        Color bg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        Color fg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        JList.DropLocation dropLocation = list.getDropLocation();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        if (dropLocation != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                && !dropLocation.isInsert()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                && dropLocation.getIndex() == index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   131
            bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground");
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   132
            fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            isSelected = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            setBackground(bg == null ? list.getSelectionBackground() : bg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            setForeground(fg == null ? list.getSelectionForeground() : fg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            setBackground(list.getBackground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            setForeground(list.getForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (value instanceof Icon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            setIcon((Icon)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            setText("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            setIcon(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            setText((value == null) ? "" : value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        setEnabled(list.isEnabled());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        setFont(list.getFont());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        Border border = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        if (cellHasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            if (isSelected) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   161
                border = DefaultLookup.getBorder(this, ui, "List.focusSelectedCellHighlightBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            if (border == null) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   164
                border = DefaultLookup.getBorder(this, ui, "List.focusCellHighlightBorder");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            border = getNoFocusBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        setBorder(border);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @return <code>true</code> if the background is completely opaque
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *         and differs from the JList's background;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   184
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    public boolean isOpaque() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        Color back = getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        Component p = getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        if (p != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            p = p.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        // p should now be the JList.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        boolean colorMatch = (back != null) && (p != null) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            back.equals(p.getBackground()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                        p.isOpaque();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return !colorMatch && super.isOpaque();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   203
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public void validate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   213
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    public void invalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   223
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public void repaint() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   231
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    public void revalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   238
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    public void repaint(long tm, int x, int y, int width, int height) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   246
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    public void repaint(Rectangle r) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   254
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        // Strings get interned...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        if (propertyName == "text"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                || ((propertyName == "font" || propertyName == "foreground")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                    && oldValue != newValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            super.firePropertyChange(propertyName, oldValue, newValue);
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
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   271
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   279
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   287
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   295
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   303
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   311
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   319
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    */
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   327
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * A subclass of DefaultListCellRenderer that implements UIResource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * DefaultListCellRenderer doesn't implement UIResource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * directly so that applications can safely override the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * cellRenderer property with DefaultListCellRenderer subclasses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * the same version of Swing.  As of 1.4, support for long term storage
20458
f2423fb3fd19 8025840: Fix all the doclint warnings about trademark
cl
parents: 5506
diff changeset
   341
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
   345
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public static class UIResource extends DefaultListCellRenderer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        implements javax.swing.plaf.UIResource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
}