--- old/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java 2017-04-18 11:47:43.122853808 -0700 +++ new/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java 2017-04-18 11:47:42.966857551 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -27,9 +27,9 @@ import java.awt.Robot; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BoxLayout; -import javax.swing.JComboBox; -import javax.swing.JFrame; +import java.lang.reflect.InvocationTargetException; +import javax.swing.*; + import test.java.awt.regtesthelpers.Util; @@ -55,16 +55,18 @@ private boolean lwClicked = false; private Point loc; private Point loc2; + private JComboBox cb; + private JFrame frame; {testEmbeddedFrame = true;} protected void prepareControls() { - final JFrame frame = new JFrame("Mixing : Dropdown Overlapping test"); + frame = new JFrame("Mixing : Dropdown Overlapping test"); frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS)); frame.setSize(200, 200); frame.setVisible(true); - final JComboBox cb = new JComboBox(petStrings); + cb = new JComboBox(petStrings); cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20)); cb.addActionListener(new ActionListener() { @@ -78,8 +80,6 @@ frame.add(cb); propagateAWTControls(frame); frame.setVisible(true); - loc = cb.getLocationOnScreen(); - loc2 = frame.getContentPane().getLocationOnScreen(); } @Override @@ -87,6 +87,16 @@ // run robot Robot robot = Util.createRobot(); robot.setAutoDelay(ROBOT_DELAY); + robot.waitForIdle(); + robot.delay(200); + try { + SwingUtilities.invokeAndWait(() -> { + loc = cb.getLocationOnScreen(); + loc2 = frame.getContentPane().getLocationOnScreen(); + }); + } catch (Exception e) { + throw new RuntimeException(e); + } loc2.translate(75, 75); pixelPreCheck(robot, loc2, currentAwtControl);