jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2658 43e06bc950ec
child 11812 fc06525cb345
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2658
diff changeset
     2
 * Copyright (c) 1997, 2006, 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: 2658
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: 2658
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: 2658
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2658
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2658
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.tree;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    28
import java.awt.Color;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    29
import java.awt.Component;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    30
import java.awt.Dimension;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    31
import java.awt.Font;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    32
import java.awt.Graphics;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    33
import java.awt.Insets;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    34
import java.awt.Rectangle;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.plaf.ColorUIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.swing.plaf.FontUIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.plaf.UIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.swing.plaf.basic.BasicGraphicsUtils;
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    39
import javax.swing.Icon;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    40
import javax.swing.JLabel;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    41
import javax.swing.JTree;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    42
import javax.swing.LookAndFeel;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    43
import javax.swing.UIManager;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    44
import javax.swing.border.EmptyBorder;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
    45
import sun.swing.DefaultLookup;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * Displays an entry in a tree.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <code>DefaultTreeCellRenderer</code> is not opaque and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * unless you subclass paint you should not change this.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * See <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * in <em>The Java Tutorial</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * for examples of customizing node display using this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * The set of icons and colors used by {@code DefaultTreeCellRenderer}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * can be configured using the various setter methods. The value for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * each property is initialized from the defaults table. When the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * look and feel changes ({@code updateUI} is invoked), any properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * that have a value of type {@code UIResource} are refreshed from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * defaults table. The following table lists the mapping between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * {@code DefaultTreeCellRenderer} property and defaults table key:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <table border="1" cellpadding="1" cellspacing="0"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *         valign="top" >
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *   <tr valign="top"  align="left">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *     <th bgcolor="#CCCCFF" align="left">Property:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *     <th bgcolor="#CCCCFF" align="left">Key:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *   <tr><td>"leafIcon"<td>"Tree.leafIcon"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *   <tr><td>"closedIcon"<td>"Tree.closedIcon"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *   <tr><td>"openIcon"<td>"Tree.openIcon"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *   <tr><td>"textSelectionColor"<td>"Tree.selectionForeground"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 *   <tr><td>"textNonSelectionColor"<td>"Tree.textForeground"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *   <tr><td>"backgroundSelectionColor"<td>"Tree.selectionBackground"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *   <tr><td>"backgroundNonSelectionColor"<td>"Tree.textBackground"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *   <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <strong><a name="override">Implementation Note:</a></strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * This class overrides
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <code>invalidate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <code>validate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <code>revalidate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * <code>repaint</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * <code>firePropertyChange</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * solely to improve performance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * If not overridden, these frequently called methods would execute code paths
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * that are unnecessary for the default tree cell renderer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * If you write your own renderer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * take care to weigh the benefits and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * drawbacks of overriding these methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * @author Rob Davis
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * @author Ray Ryan
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * @author Scott Violet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
public class DefaultTreeCellRenderer extends JLabel implements TreeCellRenderer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /** Last tree the renderer was painted in. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    private JTree tree;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /** Is the value currently selected. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    protected boolean selected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /** True if has focus. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    protected boolean hasFocus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    /** True if draws focus border around icon as well. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    private boolean drawsFocusBorderAroundIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /** If true, a dashed line is drawn as the focus indicator. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    private boolean drawDashedFocusIndicator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    // If drawDashedFocusIndicator is true, the following are used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Background color of the tree.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    private Color treeBGColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Color to draw the focus indicator in, determined from the background.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    private Color focusBGColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    // Icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /** Icon used to show non-leaf nodes that aren't expanded. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    transient protected Icon closedIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /** Icon used to show leaf nodes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    transient protected Icon leafIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /** Icon used to show non-leaf nodes that are expanded. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    transient protected Icon openIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    // Colors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    /** Color to use for the foreground for selected nodes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    protected Color textSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    /** Color to use for the foreground for non-selected nodes. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    protected Color textNonSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /** Color to use for the background when a node is selected. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    protected Color backgroundSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    /** Color to use for the background when the node isn't selected. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    protected Color backgroundNonSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /** Color to use for the focus indicator when the node has focus. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    protected Color borderSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    private boolean isDropCell;
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   159
    private boolean fillBackground = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Set to true after the constructor has run.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    private boolean inited;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Creates a {@code DefaultTreeCellRenderer}. Icons and text color are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * determined from the {@code UIManager}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public DefaultTreeCellRenderer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        inited = true;
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
     * {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public void updateUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        super.updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        // To avoid invoking new methods from the constructor, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        // inited field is first checked. If inited is false, the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        // has not run and there is no point in checking the value. As
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        // all look and feels have a non-null value for these properties,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        // a null value means the developer has specifically set it to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        // null. As such, if the value is null, this does not reset the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        // value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        if (!inited || (getLeafIcon() instanceof UIResource)) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   189
            setLeafIcon(DefaultLookup.getIcon(this, ui, "Tree.leafIcon"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        if (!inited || (getClosedIcon() instanceof UIResource)) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   192
            setClosedIcon(DefaultLookup.getIcon(this, ui, "Tree.closedIcon"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        if (!inited || (getOpenIcon() instanceof UIManager)) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   195
            setOpenIcon(DefaultLookup.getIcon(this, ui, "Tree.openIcon"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        if (!inited || (getTextSelectionColor() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            setTextSelectionColor(
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   199
                    DefaultLookup.getColor(this, ui, "Tree.selectionForeground"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if (!inited || (getTextNonSelectionColor() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            setTextNonSelectionColor(
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   203
                    DefaultLookup.getColor(this, ui, "Tree.textForeground"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        if (!inited || (getBackgroundSelectionColor() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            setBackgroundSelectionColor(
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   207
                    DefaultLookup.getColor(this, ui, "Tree.selectionBackground"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        if (!inited ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                (getBackgroundNonSelectionColor() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            setBackgroundNonSelectionColor(
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   212
                    DefaultLookup.getColor(this, ui, "Tree.textBackground"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        if (!inited || (getBorderSelectionColor() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            setBorderSelectionColor(
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   216
                    DefaultLookup.getColor(this, ui, "Tree.selectionBorderColor"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        }
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   218
        drawsFocusBorderAroundIcon = DefaultLookup.getBoolean(
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   219
                this, ui, "Tree.drawsFocusBorderAroundIcon", false);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   220
        drawDashedFocusIndicator = DefaultLookup.getBoolean(
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   221
                this, ui, "Tree.drawDashedFocusIndicator", false);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   222
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   223
        fillBackground = DefaultLookup.getBoolean(this, ui, "Tree.rendererFillBackground", true);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   224
        Insets margins = DefaultLookup.getInsets(this, ui, "Tree.rendererMargins");
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   225
        if (margins != null) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   226
            setBorder(new EmptyBorder(margins.top, margins.left,
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   227
                    margins.bottom, margins.right));
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   228
        }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   229
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   230
        setName("Tree.cellRenderer");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
      * Returns the default icon, for the current laf, that is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      * represent non-leaf nodes that are expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    public Icon getDefaultOpenIcon() {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   239
        return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      * Returns the default icon, for the current laf, that is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
      * represent non-leaf nodes that are not expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public Icon getDefaultClosedIcon() {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   247
        return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      * Returns the default icon, for the current laf, that is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      * represent leaf nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    public Icon getDefaultLeafIcon() {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   255
        return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      * Sets the icon used to represent non-leaf nodes that are expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public void setOpenIcon(Icon newIcon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        openIcon = newIcon;
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
      * Returns the icon used to represent non-leaf nodes that are expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public Icon getOpenIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        return openIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      * Sets the icon used to represent non-leaf nodes that are not expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    public void setClosedIcon(Icon newIcon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        closedIcon = newIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      * Returns the icon used to represent non-leaf nodes that are not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      * expanded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    public Icon getClosedIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        return closedIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
      * Sets the icon used to represent leaf nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    public void setLeafIcon(Icon newIcon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        leafIcon = newIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      * Returns the icon used to represent leaf nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    public Icon getLeafIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        return leafIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      * Sets the color the text is drawn with when the node is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    public void setTextSelectionColor(Color newColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        textSelectionColor = newColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      * Returns the color the text is drawn with when the node is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    public Color getTextSelectionColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        return textSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      * Sets the color the text is drawn with when the node isn't selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public void setTextNonSelectionColor(Color newColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        textNonSelectionColor = newColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
      * Returns the color the text is drawn with when the node isn't selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    public Color getTextNonSelectionColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        return textNonSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
      * Sets the color to use for the background if node is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    public void setBackgroundSelectionColor(Color newColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        backgroundSelectionColor = newColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
      * Returns the color to use for the background if node is selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    public Color getBackgroundSelectionColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        return backgroundSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
      * Sets the background color to be used for non selected nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    public void setBackgroundNonSelectionColor(Color newColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        backgroundNonSelectionColor = newColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
      * Returns the background color to be used for non selected nodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    public Color getBackgroundNonSelectionColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        return backgroundNonSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
      * Sets the color to use for the border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    public void setBorderSelectionColor(Color newColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        borderSelectionColor = newColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
      * Returns the color the border is drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    public Color getBorderSelectionColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        return borderSelectionColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * Subclassed to map <code>FontUIResource</code>s to null. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * <code>font</code> is null, or a <code>FontUIResource</code>, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * has the effect of letting the font of the JTree show
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * through. On the other hand, if <code>font</code> is non-null, and not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * a <code>FontUIResource</code>, the font becomes <code>font</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public void setFont(Font font) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        if(font instanceof FontUIResource)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            font = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        super.setFont(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * Gets the font of this component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * @return this component's font; if a font has not been set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * for this component, the font of its parent is returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    public Font getFont() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        Font font = super.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        if (font == null && tree != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            // Strive to return a non-null value, otherwise the html support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            // will typically pick up the wrong font in certain situations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
            font = tree.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        return font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * Subclassed to map <code>ColorUIResource</code>s to null. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * <code>color</code> is null, or a <code>ColorUIResource</code>, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * has the effect of letting the background color of the JTree show
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * through. On the other hand, if <code>color</code> is non-null, and not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * a <code>ColorUIResource</code>, the background becomes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * <code>color</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    public void setBackground(Color color) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        if(color instanceof ColorUIResource)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            color = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        super.setBackground(color);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
      * Configures the renderer based on the passed in components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
      * The value is set from messaging the tree with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
      * <code>convertValueToText</code>, which ultimately invokes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
      * <code>toString</code> on <code>value</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
      * The foreground color is set based on the selection and the icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      * is set based on the <code>leaf</code> and <code>expanded</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
      * parameters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    public Component getTreeCellRendererComponent(JTree tree, Object value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                                                  boolean sel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                                  boolean expanded,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                                                  boolean leaf, int row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                                                  boolean hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        String         stringValue = tree.convertValueToText(value, sel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                                          expanded, leaf, row, hasFocus);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        this.tree = tree;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        this.hasFocus = hasFocus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        setText(stringValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        Color fg = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        isDropCell = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        JTree.DropLocation dropLocation = tree.getDropLocation();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        if (dropLocation != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                && dropLocation.getChildIndex() == -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                && tree.getRowForPath(dropLocation.getPath()) == row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   444
            Color col = DefaultLookup.getColor(this, ui, "Tree.dropCellForeground");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
            if (col != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                fg = col;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                fg = getTextSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            isDropCell = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        } else if (sel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            fg = getTextSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            fg = getTextNonSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        setForeground(fg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   460
        Icon icon = null;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   461
        if (leaf) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   462
            icon = getLeafIcon();
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   463
        } else if (expanded) {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   464
            icon = getOpenIcon();
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   465
        } else {
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   466
            icon = getClosedIcon();
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   467
        }
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   468
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        if (!tree.isEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            setEnabled(false);
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   471
            LookAndFeel laf = UIManager.getLookAndFeel();
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   472
            Icon disabledIcon = laf.getDisabledIcon(tree, icon);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   473
            if (disabledIcon != null) icon = disabledIcon;
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   474
            setDisabledIcon(icon);
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   475
        } else {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            setEnabled(true);
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   477
            setIcon(icon);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        setComponentOrientation(tree.getComponentOrientation());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        selected = sel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
      * Paints the value.  The background is filled based on selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    public void paint(Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        Color bColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        if (isDropCell) {
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   493
            bColor = DefaultLookup.getColor(this, ui, "Tree.dropCellBackground");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
            if (bColor == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                bColor = getBackgroundSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        } else if (selected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            bColor = getBackgroundSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            bColor = getBackgroundNonSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            if (bColor == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
                bColor = getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
        int imageOffset = -1;
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 2
diff changeset
   507
        if (bColor != null && fillBackground) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            imageOffset = getLabelStart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            g.setColor(bColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
            if(getComponentOrientation().isLeftToRight()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
                g.fillRect(imageOffset, 0, getWidth() - imageOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
                           getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
                g.fillRect(0, 0, getWidth() - imageOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                           getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        if (hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
            if (drawsFocusBorderAroundIcon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                imageOffset = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            else if (imageOffset == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                imageOffset = getLabelStart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            if(getComponentOrientation().isLeftToRight()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                paintFocus(g, imageOffset, 0, getWidth() - imageOffset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                           getHeight(), bColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
                paintFocus(g, 0, 0, getWidth() - imageOffset, getHeight(), bColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        super.paint(g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    private void paintFocus(Graphics g, int x, int y, int w, int h, Color notColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
        Color       bsColor = getBorderSelectionColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        if (bsColor != null && (selected || !drawDashedFocusIndicator)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
            g.setColor(bsColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
            g.drawRect(x, y, w - 1, h - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        if (drawDashedFocusIndicator && notColor != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
            if (treeBGColor != notColor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                treeBGColor = notColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
                focusBGColor = new Color(~notColor.getRGB());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
            g.setColor(focusBGColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
            BasicGraphicsUtils.drawDashedRect(g, x, y, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    private int getLabelStart() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        Icon currentI = getIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        if(currentI != null && getText() != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            return currentI.getIconWidth() + Math.max(0, getIconTextGap() - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * Overrides <code>JComponent.getPreferredSize</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * return slightly wider preferred size value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    public Dimension getPreferredSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        Dimension        retDimension = super.getPreferredSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        if(retDimension != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
            retDimension = new Dimension(retDimension.width + 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                                         retDimension.height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
        return retDimension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    public void validate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    public void invalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    public void revalidate() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    public void repaint(long tm, int x, int y, int width, int height) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    public void repaint(Rectangle r) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    public void repaint() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        // Strings get interned...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        if (propertyName == "text"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
                || ((propertyName == "font" || propertyName == "foreground")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
                    && oldValue != newValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
            super.firePropertyChange(propertyName, oldValue, newValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
    public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
    public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    * Overridden for performance reasons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
    * See the <a href="#override">Implementation Note</a>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
    public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
}