< prev index next >

test/javax/swing/JPopupMenu/6217905/bug6217905.java

Print this page
rev 17561 : 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests.
Summary: Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows.
   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 /*
  24 @test
  25 @bug 6217905
  26 @summary JPopupMenu keyboard navigation stops working
  27 @author Alexander Potochkin
  28 @library ../../../../lib/testlibrary
  29 @build ExtendedRobot
  30 @run main bug6217905
  31 */



  32 
  33 import javax.swing.*;
  34 import java.awt.*;
  35 import java.awt.event.InputEvent;
  36 import java.awt.event.KeyEvent;
  37 
  38 public class bug6217905 {
  39     private static JPanel popupPanel;
  40     private static JMenuItem firstItem;
  41     private static JMenuItem lastItem;
  42 
  43     private static void createGui() {
  44         final JFrame frame = new JFrame();
  45         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  46 
  47         JPopupMenu popup = new JPopupMenu("Menu");
  48         firstItem = new JMenuItem("MenuItem");
  49         popup.add(firstItem);
  50         popup.add(new JMenuItem("MenuItem"));
  51         lastItem = new JMenuItem("MenuItem");


   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 6217905
  28  * @summary JPopupMenu keyboard navigation stops working
  29  * @author Alexander Potochkin
  30  * @requires (os.family == "windows")
  31  * @library ../../../../lib/testlibrary
  32  * @build ExtendedRobot
  33  * @run main bug6217905
  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 bug6217905 {
  42     private static JPanel popupPanel;
  43     private static JMenuItem firstItem;
  44     private static JMenuItem lastItem;
  45 
  46     private static void createGui() {
  47         final JFrame frame = new JFrame();
  48         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  49 
  50         JPopupMenu popup = new JPopupMenu("Menu");
  51         firstItem = new JMenuItem("MenuItem");
  52         popup.add(firstItem);
  53         popup.add(new JMenuItem("MenuItem"));
  54         lastItem = new JMenuItem("MenuItem");


< prev index next >