1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 /* @test
24 @bug 6538132
25 @summary Regression: Pressing Escape key don't close the menu items from jdk7.0 b07 onwards
26 @author Alexander Potochkin
27 @library ../../../../lib/testlibrary
28 @build ExtendedRobot
29 @run main bug6538132
30 */
31
32 import javax.swing.*;
33 import java.awt.*;
34 import java.awt.event.InputEvent;
35 import java.awt.event.KeyEvent;
36
37 public class bug6538132 {
38 private static JMenu menu1;
39 private static JMenu menu2;
40 private static volatile boolean isWinLaf;
41
42 private static void createGui() {
43 try {
44 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
45 isWinLaf = true;
46 } catch (Exception e) {
47 // If we can't set WinLaf it means we are not under Windows
48 // make the test pass
49 isWinLaf = false;
50 return;
|
1 /*
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @key headful
27 * @bug 6538132
28 * @summary Regression: Pressing Escape key don't close the menu items from jdk7.0 b07 onwards
29 * @author Alexander Potochkin
30 * @requires (os.family == "windows")
31 * @library ../../../../lib/testlibrary
32 * @build ExtendedRobot
33 * @run main bug6538132
34 */
35
36 import javax.swing.*;
37 import java.awt.*;
38 import java.awt.event.InputEvent;
39 import java.awt.event.KeyEvent;
40
41 public class bug6538132 {
42 private static JMenu menu1;
43 private static JMenu menu2;
44 private static volatile boolean isWinLaf;
45
46 private static void createGui() {
47 try {
48 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
49 isWinLaf = true;
50 } catch (Exception e) {
51 // If we can't set WinLaf it means we are not under Windows
52 // make the test pass
53 isWinLaf = false;
54 return;
|