jdk/src/share/classes/javax/swing/ImageIcon.java
author dmarkov
Wed, 16 Apr 2014 12:51:25 +0400
changeset 24184 4da2f6ec4dab
parent 22574 7f8ce0c8c20a
child 25201 4adc75e0c4e5
permissions -rw-r--r--
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable Reviewed-by: alexp, alexsch
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: 21257
diff changeset
     2
 * Copyright (c) 1997, 2013, 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: 1843
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: 1843
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: 1843
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1843
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1843
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.image.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.beans.ConstructorProperties;
466
6acd5ec503a8 4935607: RFE: LTP: Should be possible to set the TRANSIENT attribute of propertiies to FALSE
malenkov
parents: 2
diff changeset
    30
import java.beans.Transient;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.Locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.accessibility.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.awt.AppContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.lang.reflect.Field;
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
    43
import java.security.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * An implementation of the Icon interface that paints Icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * from Images. Images that are created from a URL, filename or byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * are preloaded using MediaTracker to monitor the loaded state
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * For further information and examples of using image icons, see
20455
f6f9a0c2796b 8020688: Broken links in documentation at http://docs.oracle.com/javase/6/docs/api/index.
mcherkas
parents: 9850
diff changeset
    53
 * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html">How to Use Icons</a>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * in <em>The Java Tutorial.</em>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * 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: 20455
diff changeset
    62
 * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * @author Jeff Dinkins
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * @author Lynn Monsanto
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 21257
diff changeset
    69
@SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
public class ImageIcon implements Icon, Serializable, Accessible {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /* Keep references to the filename and location so that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * alternate persistence schemes have the option to archive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * images symbolically rather than including the image data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * in the archive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    transient private String filename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    transient private URL location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    transient Image image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    transient int loadStatus = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    ImageObserver imageObserver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    String description = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
21257
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    84
    /**
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    85
     * Do not use this shared component, which is used to track image loading.
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    86
     * It is left for backward compatibility only.
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    87
     * @deprecated since 1.8
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    88
     */
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    89
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    protected final static Component component;
21257
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    91
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    92
    /**
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    93
     * Do not use this shared media tracker, which is used to load images.
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    94
     * It is left for backward compatibility only.
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    95
     * @deprecated since 1.8
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    96
     */
57214b6e9c3e 7035495: javax.swing.ImageIcon spec should be clarified
malenkov
parents: 20458
diff changeset
    97
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    protected final static MediaTracker tracker;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    static {
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   101
        component = AccessController.doPrivileged(new PrivilegedAction<Component>() {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   102
            public Component run() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                try {
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   104
                    final Component component = createNoPermsComponent();
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   105
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                    // 6482575 - clear the appContext field so as not to leak it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                    Field appContextField =
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   108
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   109
                            Component.class.getDeclaredField("appContext");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                    appContextField.setAccessible(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                    appContextField.set(component, null);
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   112
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   113
                    return component;
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   114
                } catch (Throwable e) {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   115
                    // We don't care about component.
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   116
                    // So don't prevent class initialisation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                    e.printStackTrace();
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   118
                    return null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        tracker = new MediaTracker(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
9850
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   125
    private static Component createNoPermsComponent() {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   126
        // 7020198 - set acc field to no permissions and no subject
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   127
        // Note, will have appContext set.
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   128
        return AccessController.doPrivileged(
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   129
                new PrivilegedAction<Component>() {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   130
                    public Component run() {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   131
                        return new Component() {
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   132
                        };
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   133
                    }
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   134
                },
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   135
                new AccessControlContext(new ProtectionDomain[]{
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   136
                        new ProtectionDomain(null, null)
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   137
                })
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   138
        );
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   139
    }
2689977af15b 7020198: ImageIcon creates Component with null acc
alexp
parents: 5506
diff changeset
   140
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * Id used in loading images from MediaTracker.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    private static int mediaTrackerID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    private final static Object TRACKER_KEY = new StringBuilder("TRACKER_KEY");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    int width = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    int height = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * Creates an ImageIcon from the specified file. The image will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * be preloaded by using MediaTracker to monitor the loading state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @param filename the name of the file containing the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @param description a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @see #ImageIcon(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    public ImageIcon(String filename, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        image = Toolkit.getDefaultToolkit().getImage(filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        this.filename = filename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        loadImage(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * Creates an ImageIcon from the specified file. The image will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * be preloaded by using MediaTracker to monitor the loading state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * of the image. The specified String can be a file name or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * file path. When specifying a path, use the Internet-standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * forward-slash ("/") as a separator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * (The string is converted to an URL, so the forward-slash works
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * on all systems.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * For example, specify:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     *    new ImageIcon("images/myImage.gif") </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * The description is initialized to the <code>filename</code> string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @param filename a String specifying a filename or path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * @see #getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    @ConstructorProperties({"description"})
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    public ImageIcon (String filename) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        this(filename, filename);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * Creates an ImageIcon from the specified URL. The image will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * be preloaded by using MediaTracker to monitor the loaded state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @param location the URL for the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param description a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @see #ImageIcon(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public ImageIcon(URL location, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        image = Toolkit.getDefaultToolkit().getImage(location);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        this.location = location;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        loadImage(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * Creates an ImageIcon from the specified URL. The image will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * be preloaded by using MediaTracker to monitor the loaded state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * The icon's description is initialized to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * a string representation of the URL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @param location the URL for the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @see #getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    public ImageIcon (URL location) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        this(location, location.toExternalForm());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Creates an ImageIcon from the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @param image the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @param description a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public ImageIcon(Image image, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        this(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Creates an ImageIcon from an image object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * If the image has a "comment" property that is a string,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * then the string is used as the description of this icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @param image the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @see #getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @see java.awt.Image#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    public ImageIcon (Image image) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        this.image = image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        Object o = image.getProperty("comment", imageObserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        if (o instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            description = (String) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        loadImage(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Creates an ImageIcon from an array of bytes which were
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * read from an image file containing a supported image format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * such as GIF, JPEG, or (as of 1.3) PNG.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * Normally this array is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * by reading an image using Class.getResourceAsStream(), but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * the byte array may also be statically stored in a class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @param  imageData an array of pixels in an image format supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *         by the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @param  description a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * @see    java.awt.Toolkit#createImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public ImageIcon (byte[] imageData, String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        this.image = Toolkit.getDefaultToolkit().createImage(imageData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        loadImage(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Creates an ImageIcon from an array of bytes which were
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * read from an image file containing a supported image format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * such as GIF, JPEG, or (as of 1.3) PNG.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Normally this array is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * by reading an image using Class.getResourceAsStream(), but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * the byte array may also be statically stored in a class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * If the resulting image has a "comment" property that is a string,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * then the string is used as the description of this icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @param  imageData an array of pixels in an image format supported by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *             the AWT Toolkit, such as GIF, JPEG, or (as of 1.3) PNG
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @see    java.awt.Toolkit#createImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @see #getDescription
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @see java.awt.Image#getProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    public ImageIcon (byte[] imageData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        this.image = Toolkit.getDefaultToolkit().createImage(imageData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        Object o = image.getProperty("comment", imageObserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        if (o instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            description = (String) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        loadImage(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * Creates an uninitialized image icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    public ImageIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * Loads the image, returning only when the image is loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param image the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    protected void loadImage(Image image) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        MediaTracker mTracker = getTracker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        synchronized(mTracker) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            int id = getNextID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            mTracker.addImage(image, id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                mTracker.waitForID(id, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            } catch (InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                System.out.println("INTERRUPTED while loading Image");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            loadStatus = mTracker.statusID(id, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            mTracker.removeImage(image, id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            width = image.getWidth(imageObserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            height = image.getHeight(imageObserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * Returns an ID to use with the MediaTracker in loading an image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    private int getNextID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        synchronized(getTracker()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            return ++mediaTrackerID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        }
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
     * Returns the MediaTracker for the current AppContext, creating a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * MediaTracker if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    private MediaTracker getTracker() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        Object trackerObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        AppContext ac = AppContext.getAppContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        // Opt: Only synchronize if trackerObj comes back null?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        // If null, synchronize, re-check for null, and put new tracker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        synchronized(ac) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            trackerObj = ac.get(TRACKER_KEY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            if (trackerObj == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                Component comp = new Component() {};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                trackerObj = new MediaTracker(comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                ac.put(TRACKER_KEY, trackerObj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        return (MediaTracker) trackerObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * Returns the status of the image loading operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @return the loading status as defined by java.awt.MediaTracker
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @see java.awt.MediaTracker#ABORTED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @see java.awt.MediaTracker#ERRORED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @see java.awt.MediaTracker#COMPLETE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    public int getImageLoadStatus() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        return loadStatus;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * Returns this icon's <code>Image</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @return the <code>Image</code> object for this <code>ImageIcon</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     */
466
6acd5ec503a8 4935607: RFE: LTP: Should be possible to set the TRANSIENT attribute of propertiies to FALSE
malenkov
parents: 2
diff changeset
   371
    @Transient
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public Image getImage() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        return image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * Sets the image displayed by this icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @param image the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    public void setImage(Image image) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        this.image = image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        loadImage(image);
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 description of the image.  This is meant to be a brief
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * textual description of the object.  For example, it might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * presented to a blind user to give an indication of the purpose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * The description may be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * @return a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    public String getDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        return description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * Sets the description of the image.  This is meant to be a brief
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * textual description of the object.  For example, it might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * presented to a blind user to give an indication of the purpose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @param description a brief textual description of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    public void setDescription(String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        this.description = description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * Paints the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * The top-left corner of the icon is drawn at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * the point (<code>x</code>, <code>y</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * in the coordinate space of the graphics context <code>g</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * If this icon has no image observer,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * this method uses the <code>c</code> component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * as the observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @param c the component to be used as the observer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *          if this icon has no image observer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * @param g the graphics context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @param x the X coordinate of the icon's top-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @param y the Y coordinate of the icon's top-left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        if(imageObserver == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
           g.drawImage(image, x, y, c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
           g.drawImage(image, x, y, imageObserver);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * Gets the width of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @return the width in pixels of this icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        return width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * Gets the height of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * @return the height in pixels of this icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        return height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * Sets the image observer for the image.  Set this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * property if the ImageIcon contains an animated GIF, so
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * the observer is notified to update its display.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     *     icon = new ImageIcon(...)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     *     button.setIcon(icon);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     *     icon.setImageObserver(button);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param observer the image observer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    public void setImageObserver(ImageObserver observer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        imageObserver = observer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * Returns the image observer for the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * @return the image observer, which may be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     */
466
6acd5ec503a8 4935607: RFE: LTP: Should be possible to set the TRANSIENT attribute of propertiies to FALSE
malenkov
parents: 2
diff changeset
   472
    @Transient
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    public ImageObserver getImageObserver() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        return imageObserver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * Returns a string representation of this image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * @return a string representing this image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        if (description != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            return description;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        return super.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    private void readObject(ObjectInputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        throws ClassNotFoundException, IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        s.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        int w = s.readInt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        int h = s.readInt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        int[] pixels = (int[])(s.readObject());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        if (pixels != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            Toolkit tk = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            ColorModel cm = ColorModel.getRGBdefault();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            image = tk.createImage(new MemoryImageSource(w, h, cm, pixels, 0, w));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            loadImage(image);
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    private void writeObject(ObjectOutputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        s.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        int w = getIconWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        int h = getIconHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        int[] pixels = image != null? new int[w * h] : null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        if (image != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                PixelGrabber pg = new PixelGrabber(image, 0, 0, w, h, pixels, 0, w);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                pg.grabPixels();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                    throw new IOException("failed to load image contents");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
            catch (InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
                throw new IOException("image load interrupted");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        s.writeInt(w);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        s.writeInt(h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        s.writeObject(pixels);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * --- Accessibility Support ---
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    private AccessibleImageIcon accessibleContext = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * Gets the AccessibleContext associated with this ImageIcon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * For image icons, the AccessibleContext takes the form of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * AccessibleImageIcon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * A new AccessibleImageIcon instance is created if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * @return an AccessibleImageIcon that serves as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     *         AccessibleContext of this ImageIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @beaninfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     *       expert: true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     *  description: The AccessibleContext associated with this ImageIcon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    public AccessibleContext getAccessibleContext() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        if (accessibleContext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            accessibleContext = new AccessibleImageIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        return accessibleContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * This class implements accessibility support for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * <code>ImageIcon</code> class.  It provides an implementation of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * Java Accessibility API appropriate to image icon user-interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * 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: 20455
diff changeset
   571
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 21257
diff changeset
   576
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    protected class AccessibleImageIcon extends AccessibleContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        implements AccessibleIcon, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
         * AccessibleContest implementation -----------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
         * Gets the role of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
         * @return an instance of AccessibleRole describing the role of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
         * object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
         * @see AccessibleRole
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        public AccessibleRole getAccessibleRole() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
            return AccessibleRole.ICON;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
         * Gets the state of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
         * @return an instance of AccessibleStateSet containing the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
         * state set of the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
         * @see AccessibleState
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        public AccessibleStateSet getAccessibleStateSet() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
         * Gets the Accessible parent of this object.  If the parent of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
         * object implements Accessible, this method should simply return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
         * getParent().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
         * @return the Accessible parent of this object -- can be null if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
         * object does not have an Accessible parent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
        public Accessible getAccessibleParent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
         * Gets the index of this object in its accessible parent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
         * @return the index of this object in its parent; -1 if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
         * object does not have an accessible parent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
         * @see #getAccessibleParent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        public int getAccessibleIndexInParent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
         * Returns the number of accessible children in the object.  If all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
         * of the children of this object implement Accessible, than this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
         * method should return the number of children of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
         * @return the number of accessible children in the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        public int getAccessibleChildrenCount() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
         * Returns the nth Accessible child of the object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
         * @param i zero-based index of child
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
         * @return the nth Accessible child of the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        public Accessible getAccessibleChild(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
         * Returns the locale of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
         * @return the locale of this object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
        public Locale getLocale() throws IllegalComponentStateException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
         * AccessibleIcon implementation -----------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
         * Gets the description of the icon.  This is meant to be a brief
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
         * textual description of the object.  For example, it might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
         * presented to a blind user to give an indication of the purpose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
         * of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
         * @return the description of the icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
        public String getAccessibleIconDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
            return ImageIcon.this.getDescription();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
         * Sets the description of the icon.  This is meant to be a brief
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
         * textual description of the object.  For example, it might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
         * presented to a blind user to give an indication of the purpose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
         * of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
         * @param description the description of the icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
        public void setAccessibleIconDescription(String description) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
            ImageIcon.this.setDescription(description);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
         * Gets the height of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
         * @return the height of the icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        public int getAccessibleIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
            return ImageIcon.this.height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
         * Gets the width of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
         * @return the width of the icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        public int getAccessibleIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
            return ImageIcon.this.width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        private void readObject(ObjectInputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
            throws ClassNotFoundException, IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
            s.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
        private void writeObject(ObjectOutputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            throws IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
            s.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
    }  // AccessibleImageIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
}