test/java/awt/Focus/8073453/AWTFocusTransitionTest.java

Print this page

        

*** 26,79 **** * @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(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); ! toolkit.realSync(); checkFocusOwner(button); robot.keyPress(KeyEvent.VK_SHIFT); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); ! toolkit.realSync(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_SHIFT); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); ! toolkit.realSync(); checkFocusOwner(button); } finally { if (frame != null) { frame.dispose(); --- 26,76 ---- * @summary Focus doesn't move when pressing Shift + Tab keys * @author Dmitry Markov * @compile AWTFocusTransitionTest.java * @run main/othervm AWTFocusTransitionTest */ import java.awt.*; import java.awt.event.KeyEvent; public class AWTFocusTransitionTest { private static Robot robot; private static Frame frame; private static TextField textField; private static Button button; public static void main(String[] args) throws Exception { robot = new Robot(); robot.setAutoDelay(50); try { createAndShowGUI(); ! robot.waitForIdle(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); ! robot.waitForIdle(); checkFocusOwner(button); robot.keyPress(KeyEvent.VK_SHIFT); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); ! robot.waitForIdle(); checkFocusOwner(textField); robot.keyPress(KeyEvent.VK_SHIFT); robot.keyPress(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_TAB); robot.keyRelease(KeyEvent.VK_SHIFT); ! robot.waitForIdle(); checkFocusOwner(button); } finally { if (frame != null) { frame.dispose();