jdk/test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java
author sogoel
Fri, 05 Sep 2014 16:51:39 -0700
changeset 26529 10ec5e52bf75
parent 25107 9a16a601de25
child 31448 1066345d2a8a
permissions -rw-r--r--
8055079: Group 9c: golden files for tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25107
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     1
/*
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     4
 *
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     8
 *
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    13
 * accompanied this code).
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    14
 *
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    18
 *
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    21
 * questions.
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    22
 */
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    23
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    24
import java.awt.Color;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    25
import java.awt.Graphics;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    26
import java.awt.Image;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    27
import java.awt.Toolkit;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    28
import java.awt.image.BufferedImage;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    29
import java.awt.image.ImageObserver;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    30
import static java.awt.image.ImageObserver.ALLBITS;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    31
import java.io.File;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    32
import javax.imageio.ImageIO;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    33
import sun.awt.OSInfo;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    34
import sun.awt.SunToolkit;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    35
import sun.awt.image.MultiResolutionToolkitImage;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    36
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    37
/**
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    38
 * @test
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    39
 * @bug 8040291
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    40
 * @author Alexander Scherbatiy
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    41
 * @summary [macosx] Http-Images are not fully loaded when using ImageIcon
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    42
 * @run main MultiResolutionToolkitImageTest
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    43
 */
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    44
public class MultiResolutionToolkitImageTest {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    45
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    46
    private static final int IMAGE_WIDTH = 300;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    47
    private static final int IMAGE_HEIGHT = 200;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    48
    private static final Color COLOR_1X = Color.GREEN;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    49
    private static final Color COLOR_2X = Color.BLUE;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    50
    private static final String IMAGE_NAME_1X = "image.png";
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    51
    private static final String IMAGE_NAME_2X = "image@2x.png";
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    52
    private static final int WAIT_TIME = 400;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    53
    private static volatile boolean isImageLoaded = false;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    54
    private static volatile boolean isRVObserverCalled = false;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    55
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    56
    public static void main(String[] args) throws Exception {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    57
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    58
        if (!checkOS()) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    59
            return;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    60
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    61
        generateImages();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    62
        testToolkitMultiResolutionImageLoad();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    63
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    64
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    65
    static void testToolkitMultiResolutionImageLoad() throws Exception {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    66
        File imageFile = new File(IMAGE_NAME_1X);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    67
        String fileName = imageFile.getAbsolutePath();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    68
        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    69
        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    70
        toolkit.prepareImage(image, -1, -1, new LoadImageObserver());
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    71
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    72
        final long time = WAIT_TIME + System.currentTimeMillis();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    73
        while ((!isImageLoaded || !isRVObserverCalled)
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    74
                && System.currentTimeMillis() < time) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    75
            Thread.sleep(50);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    76
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    77
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    78
        if(!isImageLoaded){
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    79
            throw new RuntimeException("Image is not loaded!");
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    80
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    81
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    82
        if(!isRVObserverCalled){
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    83
            throw new RuntimeException("Resolution Variant observer is not called!");
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    84
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    85
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    86
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    87
    static void generateImages() throws Exception {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    88
        if (!new File(IMAGE_NAME_1X).exists()) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    89
            generateImage(1);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    90
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    91
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    92
        if (!new File(IMAGE_NAME_2X).exists()) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    93
            generateImage(2);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    94
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    95
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    96
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    97
    static void generateImage(int scale) throws Exception {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    98
        BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
    99
                BufferedImage.TYPE_INT_RGB);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   100
        Graphics g = image.getGraphics();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   101
        g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   102
        g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   103
        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   104
        ImageIO.write(image, "png", file);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   105
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   106
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   107
    static boolean checkOS() {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   108
        return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   109
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   110
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   111
    static class LoadImageObserver implements ImageObserver {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   112
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   113
        @Override
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   114
        public boolean imageUpdate(Image img, int infoflags, int x, int y,
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   115
                int width, int height) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   116
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   117
            if (isRVObserver()) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   118
                isRVObserverCalled = true;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   119
                SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   120
                Image resolutionVariant = getResolutionVariant(img);
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   121
                int rvFlags = toolkit.checkImage(resolutionVariant, width, height,
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   122
                        new IdleImageObserver());
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   123
                if (rvFlags < infoflags) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   124
                    throw new RuntimeException("Info flags are greater than"
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   125
                            + " resolution varint info flags");
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   126
                }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   127
            } else if ((infoflags & ALLBITS) != 0) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   128
                isImageLoaded = true;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   129
            }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   130
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   131
            return (infoflags & ALLBITS) == 0;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   132
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   133
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   134
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   135
    static boolean isRVObserver() {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   136
        Exception e = new Exception();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   137
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   138
        for (StackTraceElement elem : e.getStackTrace()) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   139
            if (elem.getClassName().endsWith("MultiResolutionToolkitImage")) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   140
                return true;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   141
            }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   142
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   143
        return false;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   144
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   145
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   146
    static class IdleImageObserver implements ImageObserver {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   147
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   148
        @Override
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   149
        public boolean imageUpdate(Image img, int infoflags, int x, int y,
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   150
                int width, int height) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   151
            return false;
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   152
        }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   153
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   154
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   155
    static Image getResolutionVariant(Image image) {
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   156
        return ((MultiResolutionToolkitImage) image).getResolutionVariant();
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   157
    }
9a16a601de25 8040291: [macosx] Http-Images are not fully loaded when using ImageIcon
alexsch
parents:
diff changeset
   158
}