From 1ed59c02c88d783e6a8e6fe8b330a73a59b463e2 Mon Sep 17 00:00:00 2001 From: Maksim Khramov Date: Mon, 5 Dec 2016 18:09:05 +0300 Subject: [PATCH] 8159906: [TEST_BUG] javax/swing/JDialog/Transparency/TransparencyTest.java Reviewed-by: psadhukhan, yan --- .../JDialog/Transparency/TransparencyTest.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java index 5c6080c336f..81dfea088a4 100644 --- a/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java +++ b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java @@ -24,10 +24,12 @@ /* @test @key headful - @bug 8062946 + @bug 8062946 8159906 @summary Verify Transparency upon iconify/deiconify sequence @run main TransparencyTest */ +import java.awt.GraphicsEnvironment; +import java.awt.GraphicsDevice; import java.awt.Color; import java.awt.Point; import java.awt.Robot; @@ -43,7 +45,7 @@ public class TransparencyTest { private static final int WIDTH = 250; private static final int HEIGHT = 250; private static final float OPACITY = 0.60f; - private static Point dlgPos; + private static volatile Point dlgPos; public static void createAndShowGUI() { frame = new JFrame("JFrame"); @@ -67,6 +69,14 @@ public class TransparencyTest { public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice gd = ge.getDefaultScreenDevice(); + GraphicsDevice.WindowTranslucency mode = GraphicsDevice.WindowTranslucency.TRANSLUCENT; + boolean translucencyCheck = gd.isWindowTranslucencySupported(mode); + if(!translucencyCheck) { + return; + } + Robot robot = new Robot(); // create a GUI SwingUtilities.invokeAndWait(new Runnable() {