< prev index next >
jdk/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java
Print this page
*** 61,70 ****
--- 61,78 ----
ch.add("item 5");
w.add(ch);
w.setLayout(new FlowLayout());
w.setSize(200, 200);
+ // fix for 8039467 : [TEST_BUG] Test java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java -
+ // - lefts keystrokes in a keyboard buffer on Windows
+ // FIX: As Window w is non focusable, key press events will not be consumed by w.
+ // So creating tempFrameToHoldFocus frame, to consume key press events
+ Frame tempFrameToHoldFocus = new Frame();
+ tempFrameToHoldFocus.setVisible(true);
+ tempFrameToHoldFocus.requestFocus();
+
ch.addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e){
traceEvent("keytyped", e);
}
public void keyPressed(KeyEvent e){
*** 92,101 ****
--- 100,113 ----
// technique to accomplish that rather then checking color of dropdown
// Will suppose that the dropdown appears
testKeys();
Util.waitForIdle(robot);
+
+ tempFrameToHoldFocus.dispose();
+ w.dispose();
+ f.dispose();
}
private static void testKeys(){
typeKey(KeyEvent.VK_UP);
typeKey(KeyEvent.VK_DOWN);
< prev index next >