test/jdk/javax/swing/JPopupMenu/4634626/bug4634626.java
changeset 54231 e4813eded7cb
parent 52739 7199c4da1a6f
equal deleted inserted replaced
54230:d9d9655bb077 54231:e4813eded7cb
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 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.
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @key headful
    26  * @key headful
    27  * @bug 4634626
    27  * @bug 4634626
    28  * @summary Implement context popup menus for components
    28  * @summary Implement context popup menus for components
    29  * @author Alexander Zuev
       
    30  * @library /lib/client
    29  * @library /lib/client
    31  * @build ExtendedRobot
    30  * @build ExtendedRobot
    32  * @run applet bug4634626.html
    31  * @run main bug4634626
    33  */
    32  */
    34 
    33 
    35 import javax.swing.*;
    34 import javax.swing.*;
    36 import java.awt.event.*;
    35 import java.awt.event.*;
    37 import java.awt.*;
    36 import java.awt.*;
    38 
    37 
    39 public class bug4634626 extends JApplet {
    38 public class bug4634626 {
    40 
    39 
    41     public boolean passed = true;
    40     public boolean passed = true;
    42     public boolean done = false;
    41     public boolean done = false;
    43 
    42 
    44     public JFrame mainFrame = new JFrame("Bug4634626");
    43     public JFrame mainFrame = new JFrame("Bug4634626");
    82         }
    81         }
    83     }
    82     }
    84 
    83 
    85     public static MouseWatcher mouser = new MouseWatcher();
    84     public static MouseWatcher mouser = new MouseWatcher();
    86 
    85 
       
    86     public static void main(final String[] args) {
       
    87         bug4634626 app = new bug4634626();
       
    88         app.init();
       
    89         app.destroy();
       
    90     }
       
    91 
    87     public void init() {
    92     public void init() {
    88 
    93 
    89         try {
    94         try {
    90             popButton.setComponentPopupMenu(null);
    95             popButton.setComponentPopupMenu(null);
    91             popButton.setComponentPopupMenu(null);
    96             popButton.setComponentPopupMenu(null);
   116 
   121 
   117         mainFrame.pack();
   122         mainFrame.pack();
   118         mainFrame.setLocation(50, 50);
   123         mainFrame.setLocation(50, 50);
   119 
   124 
   120         mainFrame.addWindowListener(new TestStateListener());
   125         mainFrame.addWindowListener(new TestStateListener());
       
   126         mainFrame.setLocationRelativeTo(null);
   121         mainFrame.setVisible(true);
   127         mainFrame.setVisible(true);
   122 
   128 
   123         while(!done) Thread.yield();
   129         while(!done) Thread.yield();
   124 
   130 
   125         if(!passed) {
   131         if(!passed) {