Skip to content

Commit

Permalink
Used window getbounds
Browse files Browse the repository at this point in the history
  • Loading branch information
prsadhuk committed Nov 6, 2020
1 parent cf936ae commit 63209dd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/jdk/javax/swing/JComponent/7154030/bug7154030.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.awt.AWTException;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.GraphicsEnvironment;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
Expand Down Expand Up @@ -90,18 +89,18 @@ public void run() {

frame.setContentPane(desktop);
frame.setSize(300, 300);
Rectangle rect = GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice().getDefaultConfiguration().
getBounds();
locx = rect.width/2;
locy = rect.height/2;
frame.setLocation(locx, locy);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
});

robot.waitForIdle(1000);

Rectangle bounds = frame.getBounds();
locx = bounds.x;
locy = bounds.y;

imageInit = robot.createScreenCapture(new Rectangle(locx, locy, 300, 300));

SwingUtilities.invokeAndWait(new Runnable() {
Expand Down

0 comments on commit 63209dd

Please sign in to comment.