Java Code Examples for java.awt.GraphicsDevice

The following examples show how to use java.awt.GraphicsDevice. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
/**
 * Finds a display mode that is different from the current display
 * mode and is likely to cause a display change event.
 */
private static DisplayMode findDisplayMode(GraphicsDevice gd) {
    DisplayMode dms[] = gd.getDisplayModes();
    DisplayMode currentDM = gd.getDisplayMode();
    for (DisplayMode dm : dms) {
        if (!dm.equals(currentDM) &&
             dm.getRefreshRate() == currentDM.getRefreshRate())
        {
            // different from the current dm and refresh rate is the same
            // means that something else is different => more likely to
            // cause a DM change event
            return dm;
        }
    }
    return null;
}
 
Example 2
Source Project: hottub   Source File: DisplayChangeVITest.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    DisplayChangeVITest test = new DisplayChangeVITest();
    GraphicsDevice gd =
        GraphicsEnvironment.getLocalGraphicsEnvironment().
            getDefaultScreenDevice();
    if (gd.isFullScreenSupported()) {
        gd.setFullScreenWindow(test);
        Thread t = new Thread(test);
        t.run();
        synchronized (lock) {
            while (!done) {
                try {
                    lock.wait(50);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }
        }
        System.err.println("Test Passed.");
    } else {
        System.err.println("Full screen not supported. Test passed.");
    }
}
 
Example 3
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example 4
Source Project: haxademic   Source File: JavaInfo.java    License: MIT License 6 votes vote down vote up
public static void printDisplayInfo() {
    int g = 0;
    for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
        out.println("graphics device #"+(++g)+": "+gd.getIDstring()+" type "+gd.getType());
        out.println("\tavailable accelerated memory " + gd.getAvailableAcceleratedMemory());
        int c = 0;
        for (GraphicsConfiguration gc : gd.getConfigurations()) {
            out.println("\tgraphics configuration #"+(++c)+":");
            out.println("\t\twidth "+gc.getBounds().getWidth()+" height "+gc.getBounds().getHeight());
            out.println("\t\tfull screen "+gc.getBufferCapabilities().isFullScreenRequired());
            ImageCapabilities ic = gc.getImageCapabilities();
            out.println("\t\tis accelerated "+ic.isAccelerated());

        }
        DisplayMode dm = gd.getDisplayMode();   
        out.println("\tdisplay mode bit width "+dm.getWidth()+" height "+dm.getHeight()+" bit depth "+dm.getBitDepth()+" refresh rate "+dm.getRefreshRate());
        int m = 0;
        for (DisplayMode d : gd.getDisplayModes())
            out.println("\talt display mode #"+(++m)+" bit width "+d.getWidth()+" height "+d.getHeight()+" bit depth "+d.getBitDepth()+" refresh rate "+d.getRefreshRate());    
    }
}
 
Example 5
static void initScreenBounds() {

        GraphicsDevice[] devices = GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getScreenDevices();

        screenBounds = new Rectangle[devices.length];
        scales = new double[devices.length][2];
        for (int i = 0; i < devices.length; i++) {
            GraphicsConfiguration gc = devices[i].getDefaultConfiguration();
            screenBounds[i] = gc.getBounds();
            AffineTransform tx = gc.getDefaultTransform();
            scales[i][0] = tx.getScaleX();
            scales[i][1] = tx.getScaleY();
        }

        maxBounds = screenBounds[0];
        for (int i = 0; i < screenBounds.length; i++) {
            maxBounds = maxBounds.union(screenBounds[i]);
        }
    }
 
Example 6
Source Project: freecol   Source File: SplashScreen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Initialize the splash screen.
 *
 * @param gd The {@code GraphicsDevice} to display on.
 * @param splashStream An {@code InputStream} to read content from.
 */
public SplashScreen(GraphicsDevice gd, InputStream splashStream)
    throws IOException {
    super(gd.getDefaultConfiguration());
    
    BufferedImage im = ImageIO.read(splashStream);
    this.getContentPane().add(new JLabel(new ImageIcon(im)));
    this.pack();
    this.setVisible(false);

    Point start = this.getLocation();
    DisplayMode dm = gd.getDisplayMode();
    int x = start.x + dm.getWidth()/2 - this.getWidth() / 2;
    int y = start.y + dm.getHeight()/2 - this.getHeight() / 2;
    this.setLocation(x, y);
}
 
Example 7
public static void main(String[] args) throws Exception {
    DisplayChangeVITest test = new DisplayChangeVITest();
    GraphicsDevice gd =
        GraphicsEnvironment.getLocalGraphicsEnvironment().
            getDefaultScreenDevice();
    if (gd.isFullScreenSupported()) {
        gd.setFullScreenWindow(test);
        Thread t = new Thread(test);
        t.run();
        synchronized (lock) {
            while (!done) {
                try {
                    lock.wait(50);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            }
        }
        System.err.println("Test Passed.");
    } else {
        System.err.println("Full screen not supported. Test passed.");
    }
}
 
Example 8
Source Project: openjdk-jdk8u   Source File: bug8071705.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {

        GraphicsDevice correctDevice = null;
        if (devices.length < 2) {
            return correctDevice;
        }

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        int halfScreen = screenBounds.height/2;

        for(int i = 0; i < devices.length; i++) {
            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration conf =
                        devices[i].getDefaultConfiguration();
                Rectangle bounds = conf.getBounds();
                if (bounds.y >= halfScreen) {
                    // found
                    correctDevice = devices[i];
                    break;
                }
            }
        }
        return correctDevice;
    }
 
Example 9
Source Project: openjdk-jdk9   Source File: bug8071705.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {

        GraphicsDevice correctDevice = null;
        if (devices.length < 2) {
            return correctDevice;
        }

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        int halfScreen = screenBounds.height/2;

        for(int i = 0; i < devices.length; i++) {
            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration conf =
                        devices[i].getDefaultConfiguration();
                Rectangle bounds = conf.getBounds();
                if (bounds.y >= halfScreen) {
                    // found
                    correctDevice = devices[i];
                    break;
                }
            }
        }
        return correctDevice;
    }
 
Example 10
Source Project: dragonwell8_jdk   Source File: bug8071705.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {

        GraphicsDevice correctDevice = null;
        if (devices.length < 2) {
            return correctDevice;
        }

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        int halfScreen = screenBounds.height/2;

        for(int i = 0; i < devices.length; i++) {
            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration conf =
                        devices[i].getDefaultConfiguration();
                Rectangle bounds = conf.getBounds();
                if (bounds.y >= halfScreen) {
                    // found
                    correctDevice = devices[i];
                    break;
                }
            }
        }
        return correctDevice;
    }
 
Example 11
Source Project: jdk8u60   Source File: bug8071705.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {

        GraphicsDevice correctDevice = null;
        if (devices.length < 2) {
            return correctDevice;
        }

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        int halfScreen = screenBounds.height/2;

        for(int i = 0; i < devices.length; i++) {
            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration conf =
                        devices[i].getDefaultConfiguration();
                Rectangle bounds = conf.getBounds();
                if (bounds.y >= halfScreen) {
                    // found
                    correctDevice = devices[i];
                    break;
                }
            }
        }
        return correctDevice;
    }
 
Example 12
Source Project: jdk8u-jdk   Source File: DisplayModeChanger.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a display mode that is different from the current display
 * mode and is likely to cause a display change event.
 */
private static DisplayMode findDisplayMode(GraphicsDevice gd) {
    DisplayMode dms[] = gd.getDisplayModes();
    DisplayMode currentDM = gd.getDisplayMode();
    for (DisplayMode dm : dms) {
        if (!dm.equals(currentDM) &&
             dm.getRefreshRate() == currentDM.getRefreshRate())
        {
            // different from the current dm and refresh rate is the same
            // means that something else is different => more likely to
            // cause a DM change event
            return dm;
        }
    }
    return null;
}
 
Example 13
Source Project: jdk8u-jdk   Source File: DisplayModeChanger.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Finds a display mode that is different from the current display
 * mode and is likely to cause a display change event.
 */
private static DisplayMode findDisplayMode(GraphicsDevice gd) {
    DisplayMode dms[] = gd.getDisplayModes();
    DisplayMode currentDM = gd.getDisplayMode();
    for (DisplayMode dm : dms) {
        if (!dm.equals(currentDM) &&
             dm.getRefreshRate() == currentDM.getRefreshRate())
        {
            // different from the current dm and refresh rate is the same
            // means that something else is different => more likely to
            // cause a DM change event
            return dm;
        }
    }
    return null;
}
 
Example 14
Source Project: TencentKona-8   Source File: bug8071705.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {

        GraphicsDevice correctDevice = null;
        if (devices.length < 2) {
            return correctDevice;
        }

        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        int halfScreen = screenBounds.height/2;

        for(int i = 0; i < devices.length; i++) {
            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration conf =
                        devices[i].getDefaultConfiguration();
                Rectangle bounds = conf.getBounds();
                if (bounds.y >= halfScreen) {
                    // found
                    correctDevice = devices[i];
                    break;
                }
            }
        }
        return correctDevice;
    }
 
Example 15
Source Project: jdk8u-jdk   Source File: CheckDisplayModes.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
    if (!graphicDevice.isDisplayChangeSupported()) {
        System.err.println("Display mode change is not supported on this host. Test is considered passed.");
        return;
    }
    DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
    checkDisplayMode(defaultDisplayMode);
    graphicDevice.setDisplayMode(defaultDisplayMode);

    DisplayMode[] displayModes = graphicDevice.getDisplayModes();
    boolean isDefaultDisplayModeIncluded = false;
    for (DisplayMode displayMode : displayModes) {
        checkDisplayMode(displayMode);
        graphicDevice.setDisplayMode(displayMode);
        if (defaultDisplayMode.equals(displayMode)) {
            isDefaultDisplayModeIncluded = true;
        }
    }

    if (!isDefaultDisplayModeIncluded) {
        throw new RuntimeException("Default display mode is not included");
    }
}
 
Example 16
Source Project: freecol   Source File: Canvas.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Determine whether to use full screen or windowed mode.
 *
 * @param gd The {@code GraphicsDevice} to display to.
 * @param desiredSize An optional window {@code Dimension}.
 * @return Null if full screen is to be used, otherwise a window
 *     bounds {@code Rectangle}
 */
private static boolean checkWindowed(GraphicsDevice gd,
                                     Dimension desiredSize) {
    boolean ret;
    if (desiredSize == null) {
        if (gd.isFullScreenSupported()) {
            logger.info("Full screen mode used.");
            ret = false;
        } else {
            logger.warning("Full screen mode not supported.");
            System.err.println(Messages.message("client.fullScreen"));
            ret = true;
        }
    } else {
        logger.info("Windowed mode used.");
        ret = true;
    }
    return ret;
}
 
Example 17
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        sleep();
        for (final GraphicsDevice gd : devices) {
            try {
                gd.setFullScreenWindow(frame);
                if (gd.getFullScreenWindow() != frame) {
                    throw new RuntimeException("Wrong window");
                }
                if (frame.getGraphicsConfiguration().getDevice() != gd) {
                    throw new RuntimeException("Wrong new GraphicsDevice");
                }
            } finally {
                // cleaning up
                gd.setFullScreenWindow(null);
            }
        }
        frame.dispose();
    });
}
 
Example 18
Source Project: jdk8u-dev-jdk   Source File: X11SurfaceData.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static X11GraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (X11GraphicsConfig) peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (X11GraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example 19
Source Project: gpu-nbody   Source File: NBodyVisualizer.java    License: MIT License 5 votes vote down vote up
/**
 * Sets the window to fullscreen.
 */
private void setFullscreen() {
	final GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
	final GraphicsDevice[] devices = env.getScreenDevices();

	final GraphicsDevice device = devices[0];

	device.setFullScreenWindow(frame);
}
 
Example 20
public static void main(String[] args) {

        GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        VolatileImage vi = gc.createCompatibleVolatileImage(16, 16);
        vi.validate(gc);

        BufferedImage bi =
            new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
        int data[] = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
        data[0] = 0x0000007f;
        data[1] = 0x0000007f;
        data[2] = 0xff00007f;
        data[3] = 0xff00007f;
        Graphics2D g = vi.createGraphics();
        g.setComposite(AlphaComposite.SrcOver.derive(0.999f));
        g.drawImage(bi, 0, 0, null);

        bi = vi.getSnapshot();
        if (bi.getRGB(0, 0) != bi.getRGB(1, 1)) {
            throw new RuntimeException("Test FAILED: color at 0x0 ="+
                Integer.toHexString(bi.getRGB(0, 0))+" differs from 1x1 ="+
                Integer.toHexString(bi.getRGB(1,1)));
        }

        System.out.println("Test PASSED.");
    }
 
Example 21
private void checkEffects() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
        shapedCb.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
        transparencySld.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        nonOpaqueChb.setEnabled(false);
    }
}
 
Example 22
private static D3DGraphicsConfig getGC(WComponentPeer peer) {
    GraphicsConfiguration gc;
    if (peer != null) {
        gc =  peer.getGraphicsConfiguration();
    } else {
        GraphicsEnvironment env =
                GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        gc = gd.getDefaultConfiguration();
    }
    return (gc instanceof D3DGraphicsConfig) ? (D3DGraphicsConfig)gc : null;
}
 
Example 23
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        final GraphicsDevice[] devices =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                   .getScreenDevices();
        final Frame frame = new Frame();
        frame.setBackground(Color.GREEN);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        sleep();
        for (final GraphicsDevice gd : devices) {
            try {
                gd.setFullScreenWindow(frame);
                if (gd.getFullScreenWindow() != frame) {
                    throw new RuntimeException("Wrong window");
                }
                if (frame.getGraphicsConfiguration().getDevice() != gd) {
                    throw new RuntimeException("Wrong new GraphicsDevice");
                }
            } finally {
                // cleaning up
                gd.setFullScreenWindow(null);
            }
        }
        frame.dispose();
    });
}
 
Example 24
/**
 * Return the bounds of a GraphicsDevice, less its screen insets.
 * See also java.awt.GraphicsEnvironment.getUsableBounds();
 */
public static Rectangle getUsableBounds(GraphicsDevice gd) {
    GraphicsConfiguration gc = gd.getDefaultConfiguration();
    Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
    Rectangle usableBounds = gc.getBounds();

    usableBounds.x += insets.left;
    usableBounds.y += insets.top;
    usableBounds.width -= (insets.left + insets.right);
    usableBounds.height -= (insets.top + insets.bottom);

    return usableBounds;
}
 
Example 25
private void checkEffects() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
        shapedCb.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
        transparencySld.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        nonOpaqueChb.setEnabled(false);
    }
}
 
Example 26
public static GLXGraphicsConfig getGC(X11ComponentPeer peer) {
    if (peer != null) {
        return (GLXGraphicsConfig)peer.getGraphicsConfiguration();
    } else {
        // REMIND: this should rarely (never?) happen, but what if
        //         default config is not GLX?
        GraphicsEnvironment env =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = env.getDefaultScreenDevice();
        return (GLXGraphicsConfig)gd.getDefaultConfiguration();
    }
}
 
Example 27
public static void main(String[] args) {

        GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        VolatileImage vi = gc.createCompatibleVolatileImage(16, 16);
        vi.validate(gc);

        BufferedImage bi =
            new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
        int data[] = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
        data[0] = 0x0000007f;
        data[1] = 0x0000007f;
        data[2] = 0xff00007f;
        data[3] = 0xff00007f;
        Graphics2D g = vi.createGraphics();
        g.setComposite(AlphaComposite.SrcOver.derive(0.999f));
        g.drawImage(bi, 0, 0, null);

        bi = vi.getSnapshot();
        if (bi.getRGB(0, 0) != bi.getRGB(1, 1)) {
            throw new RuntimeException("Test FAILED: color at 0x0 ="+
                Integer.toHexString(bi.getRGB(0, 0))+" differs from 1x1 ="+
                Integer.toHexString(bi.getRGB(1,1)));
        }

        System.out.println("Test PASSED.");
    }
 
Example 28
/**
 * Returns the graphics device that this configuration is associated with.
 * 
 * @return The graphics device (never {@code null}).
 */
@Override
public GraphicsDevice getDevice() {
    if (this.device == null) {
        this.device = new SVGGraphicsDevice("JFreeSVG-GraphicsDevice", this);
    }
    return this.device;
}
 
Example 29
/**
 * Returns the default screen graphics device.
 */
public GraphicsDevice getDefaultScreenDevice() {
    GraphicsDevice[] screens = getScreenDevices();
    if (screens.length == 0) {
        throw new AWTError("no screen devices");
    }
    return screens[0];
}
 
Example 30
public static void main(String[] args) {

        GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        VolatileImage vi = gc.createCompatibleVolatileImage(16, 16);
        vi.validate(gc);

        BufferedImage bi =
            new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
        int data[] = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
        data[0] = 0x0000007f;
        data[1] = 0x0000007f;
        data[2] = 0xff00007f;
        data[3] = 0xff00007f;
        Graphics2D g = vi.createGraphics();
        g.setComposite(AlphaComposite.SrcOver.derive(0.999f));
        g.drawImage(bi, 0, 0, null);

        bi = vi.getSnapshot();
        if (bi.getRGB(0, 0) != bi.getRGB(1, 1)) {
            throw new RuntimeException("Test FAILED: color at 0x0 ="+
                Integer.toHexString(bi.getRGB(0, 0))+" differs from 1x1 ="+
                Integer.toHexString(bi.getRGB(1,1)));
        }

        System.out.println("Test PASSED.");
    }