Skip to content

Commit d3b38f6

Browse files
committed
Move middleOf calls to EDT.
1 parent a26a22e commit d3b38f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/jdk/java/awt/event/KeyEvent/KeyEventToLightweight.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ public void middleOf(Component c, Point p) {
9191
p.setLocation(loc.x + (size.width / 2), loc.y + (size.height / 2));
9292
}
9393

94-
public void performTest() throws AWTException {
94+
public void performTest() throws AWTException, InterruptedException,
95+
InvocationTargetException {
9596
Robot robot = new Robot();
9697
robot.setAutoDelay(50);
9798
robot.delay(500);
9899
robot.waitForIdle();
99100
Point target = new Point();
100-
middleOf(lwbutton, target);
101+
EventQueue.invokeAndWait(() -> middleOf(lwbutton, target));
101102
robot.mouseMove(target.x, target.y);
102103
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
103104
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
@@ -111,7 +112,7 @@ public void performTest() throws AWTException {
111112
robot.keyRelease(KeyEvent.VK_B);
112113
robot.waitForIdle();
113114
robot.delay(500);
114-
middleOf(hwbutton, target);
115+
EventQueue.invokeAndWait(() -> middleOf(hwbutton, target));
115116
robot.mouseMove(target.x, target.y);
116117
robot.keyPress(KeyEvent.VK_C);
117118
robot.keyRelease(KeyEvent.VK_C);

0 commit comments

Comments
 (0)