jdk/test/java/awt/MenuBar/DeadlockTest1/DeadlockTest1.java
author amurillo
Wed, 15 Aug 2012 16:49:38 -0700
changeset 13465 d3fc5d192448
parent 7235 06d6f1977762
child 39056 d99e63b6d962
permissions -rw-r--r--
7191765: make jdk8 the default jprt release for hs24 Reviewed-by: jcoomes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7235
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     1
/*
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     4
 *
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     8
 *
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    13
 * accompanied this code).
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    14
 *
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    18
 *
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    21
 * questions.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    22
 */
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    23
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    24
/*
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    25
  @test
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    26
  @bug 6990904
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    27
  @summary on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    28
  @author Andrei Dmitriev: area=awt-menubar
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    29
  @run main/timeout=30 DeadlockTest1
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    30
*/
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    31
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    32
import java.awt.*;
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    33
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    34
public class DeadlockTest1 {
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    35
    Frame f = new Frame("Menu Frame");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    36
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    37
    DeadlockTest1() {
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    38
        MenuBar menubar = new MenuBar();
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    39
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    40
        Menu file = new Menu("File");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    41
        Menu edit = new Menu("Edit");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    42
        Menu help = new Menu("Help");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    43
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    44
        MenuItem open = new MenuItem("Open");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    45
        MenuItem close = new MenuItem("Close");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    46
        MenuItem copy = new MenuItem("Copy");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    47
        MenuItem paste = new MenuItem("Paste");
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    48
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    49
        file.add(open);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    50
        file.add(close);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    51
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    52
        edit.add(copy);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    53
        edit.add(paste);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    54
        menubar.add(file);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    55
        menubar.add(edit);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    56
        menubar.add(help);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    57
        menubar.setHelpMenu(help);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    58
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    59
        f.setMenuBar(menubar);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    60
        f.setSize(400,200);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    61
        f.setVisible(true);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    62
        try {
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    63
            Thread.sleep(5000);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    64
        } catch (InterruptedException z) {
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    65
            throw new RuntimeException(z);
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    66
        }
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    67
        f.dispose();
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    68
     }
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    69
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    70
    public static void main(String argv[]) {
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    71
        new DeadlockTest1();
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    72
    }
06d6f1977762 6990904: (dav) on oel5.5, Frame doesn't show if the Frame has only a MenuBar as its component.
dav
parents:
diff changeset
    73
}