# HG changeset patch # User anthony # Date 1369744721 -14400 # Node ID 4ecd9cdc9c4552ebb9c3943ddd90f02f103e9640 # Parent 8f43a169e39f406a772f4816b543e4676c8a99c3 7039616: java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java should be updated Summary: Consider the test passed if the system does not support translucency Reviewed-by: art diff -r 8f43a169e39f -r 4ecd9cdc9c45 jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java --- a/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java Tue May 28 12:37:46 2013 +0400 +++ b/jdk/test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java Tue May 28 16:38:41 2013 +0400 @@ -37,11 +37,12 @@ public class TranslucentJAppletTest { + private static volatile GraphicsConfiguration graphicsConfig = null; private static JFrame frame; private static volatile boolean paintComponentCalled = false; private static void initAndShowGUI() { - frame = new JFrame(); + frame = new JFrame(graphicsConfig); JApplet applet = new JApplet(); applet.setBackground(new Color(0, 0, 0, 0)); JPanel panel = new JPanel() { @@ -66,6 +67,27 @@ { sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit(); + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + for (GraphicsDevice gd : ge.getScreenDevices()) { + if (gd.isWindowTranslucencySupported( + GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT)) + { + for (GraphicsConfiguration gc : gd.getConfigurations()) { + if (gc.isTranslucencyCapable()) { + graphicsConfig = gc; + break; + } + } + } + if (graphicsConfig != null) { + break; + } + } + if (graphicsConfig == null) { + System.out.println("The system does not support translucency. Consider the test passed."); + return; + } + Robot r = new Robot(); Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates