test/java/awt/Focus/8073453/AWTFocusTransitionTest.java
Print this page
@@ -26,54 +26,51 @@
* @summary Focus doesn't move when pressing Shift + Tab keys
* @author Dmitry Markov
* @compile AWTFocusTransitionTest.java
* @run main/othervm AWTFocusTransitionTest
*/
-import sun.awt.SunToolkit;
import java.awt.*;
import java.awt.event.KeyEvent;
public class AWTFocusTransitionTest {
- private static SunToolkit toolkit;
private static Robot robot;
private static Frame frame;
private static TextField textField;
private static Button button;
public static void main(String[] args) throws Exception {
- toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
robot = new Robot();
robot.setAutoDelay(50);
try {
createAndShowGUI();
- toolkit.realSync();
+ robot.waitForIdle();
checkFocusOwner(textField);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
- toolkit.realSync();
+ robot.waitForIdle();
checkFocusOwner(button);
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_SHIFT);
- toolkit.realSync();
+ robot.waitForIdle();
checkFocusOwner(textField);
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_SHIFT);
- toolkit.realSync();
+ robot.waitForIdle();
checkFocusOwner(button);
} finally {
if (frame != null) {
frame.dispose();