Path: blob/master/test/jdk/java/awt/MenuBar/DeadlockTest1/DeadlockTest1.java
41153 views
/*1* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24@test25@key headful26@bug 699090427@summary on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.28@author Andrei Dmitriev: area=awt-menubar29@run main/timeout=30 DeadlockTest130*/3132import java.awt.*;3334public class DeadlockTest1 {35Frame f = new Frame("Menu Frame");3637DeadlockTest1() {38MenuBar menubar = new MenuBar();3940Menu file = new Menu("File");41Menu edit = new Menu("Edit");42Menu help = new Menu("Help");4344MenuItem open = new MenuItem("Open");45MenuItem close = new MenuItem("Close");46MenuItem copy = new MenuItem("Copy");47MenuItem paste = new MenuItem("Paste");4849file.add(open);50file.add(close);5152edit.add(copy);53edit.add(paste);54menubar.add(file);55menubar.add(edit);56menubar.add(help);57menubar.setHelpMenu(help);5859f.setMenuBar(menubar);60f.setSize(400,200);61f.setVisible(true);62try {63Thread.sleep(5000);64} catch (InterruptedException z) {65throw new RuntimeException(z);66}67f.dispose();68}6970public static void main(String argv[]) {71new DeadlockTest1();72}73}747576