1 /* |
1 /* |
2 * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 @test %W% %E% |
25 @test |
26 @key headful |
26 @key headful |
27 @bug 6637607 |
27 @bug 6637607 |
28 @summary Showing a modal dlg on TAB KEY_PRESS shouldn't consume inappropriate KEY_TYPED. |
28 @summary Showing a modal dlg on TAB KEY_PRESS shouldn't consume inappropriate KEY_TYPED. |
29 @author Anton Tarasov: area=awt-focus |
|
30 @library ../../regtesthelpers |
29 @library ../../regtesthelpers |
31 @build Util |
30 @build Util |
32 @run main ConsumeNextKeyTypedOnModalShowTest |
31 @run main ConsumeNextKeyTypedOnModalShowTest |
33 */ |
32 */ |
34 |
33 |
35 import java.awt.*; |
34 import java.awt.*; |
36 import java.awt.event.*; |
35 import java.awt.event.*; |
37 import java.applet.Applet; |
|
38 import java.util.concurrent.atomic.AtomicBoolean; |
|
39 import java.lang.reflect.InvocationTargetException; |
|
40 import test.java.awt.regtesthelpers.Util; |
36 import test.java.awt.regtesthelpers.Util; |
41 |
37 |
42 public class ConsumeNextKeyTypedOnModalShowTest extends Applet { |
38 public class ConsumeNextKeyTypedOnModalShowTest { |
43 Robot robot; |
39 Robot robot; |
44 Frame frame = new Frame("Frame"); |
40 Frame frame = new Frame("Frame"); |
45 Dialog dialog = new Dialog(frame, "Dialog", true); |
41 Dialog dialog = new Dialog(frame, "Dialog", true); |
46 TextField tf0 = new TextField(); |
42 TextField tf0 = new TextField(); |
47 TextField tf1 = new TextField(); |
43 TextField tf1 = new TextField(); |
74 } |
70 } |
75 }, KeyEvent.KEY_EVENT_MASK); |
71 }, KeyEvent.KEY_EVENT_MASK); |
76 } |
72 } |
77 |
73 |
78 public void start() { |
74 public void start() { |
|
75 frame.setLocationRelativeTo(null); |
79 frame.setVisible(true); |
76 frame.setVisible(true); |
80 Util.waitTillShown(frame); |
77 Util.waitTillShown(frame); |
81 |
78 |
82 // Show the dialog. |
79 // Show the dialog. |
83 robot.keyPress(KeyEvent.VK_TAB); |
80 robot.keyPress(KeyEvent.VK_TAB); |