8258643: [TESTBUG] javax/swing/JComponent/7154030/bug7154030.java failed with "Exception: Failed to hide opaque button"

Reviewed-by: trebari, psadhukhan
This commit is contained in:
Alexander Zuev 2021-01-18 22:12:06 +00:00
parent cd25bf2ee7
commit bb0821eb6a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,14 +30,9 @@ import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.awt.AWTException;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;
@ -95,13 +90,15 @@ public class bug7154030 {
}
});
robot.delay(1000);
robot.waitForIdle(1000);
Rectangle bounds = frame.getBounds();
locx = bounds.x;
locy = bounds.y;
frw = bounds.width;
frh = bounds.height;
Insets insets = frame.getInsets();
locx = bounds.x + insets.left;
locy = bounds.y + insets.top;
frw = bounds.width - insets.left - insets.right;
frh = bounds.height - insets.top - insets.bottom;
imageInit = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh));