8172065: javax/swing/JTree/4908142/bug4908142.java The selected index should be "aad"

Backport-of: 082fdf479367612a7bd795d3becfe9830db4b2d6
This commit is contained in:
Sergey Bylokhov 2022-06-16 02:31:35 +00:00
parent f799c6ac3a
commit 528e52f4d7

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,6 +60,7 @@ public class bug4908142 {
}); });
robot.waitForIdle(); robot.waitForIdle();
robot.delay(1000);
SwingUtilities.invokeAndWait(new Runnable() { SwingUtilities.invokeAndWait(new Runnable() {
@ -70,12 +71,14 @@ public class bug4908142 {
}); });
robot.waitForIdle(); robot.waitForIdle();
robot.delay(500);
robot.keyPress(KeyEvent.VK_A); robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_A); robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A); robot.keyRelease(KeyEvent.VK_A);
robot.waitForIdle();
robot.keyPress(KeyEvent.VK_D); robot.keyPress(KeyEvent.VK_D);
robot.keyRelease(KeyEvent.VK_D); robot.keyRelease(KeyEvent.VK_D);
robot.waitForIdle(); robot.waitForIdle();
@ -114,6 +117,7 @@ public class bug4908142 {
JScrollPane sp = new JScrollPane(tree); JScrollPane sp = new JScrollPane(tree);
fr.getContentPane().add(sp); fr.getContentPane().add(sp);
fr.setLocationRelativeTo(null);
fr.setSize(200, 200); fr.setSize(200, 200);
fr.setVisible(true); fr.setVisible(true);
} }