jdk/test/javax/swing/JPopupMenu/7160604/bug7160604.java
changeset 23275 dd5d2076ce38
parent 21794 3a7def8aa5fb
equal deleted inserted replaced
23274:3b6993da89df 23275:dd5d2076ce38
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, 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.
    36 import javax.swing.JMenuItem;
    36 import javax.swing.JMenuItem;
    37 import javax.swing.JPanel;
    37 import javax.swing.JPanel;
    38 import javax.swing.JPopupMenu;
    38 import javax.swing.JPopupMenu;
    39 import javax.swing.JWindow;
    39 import javax.swing.JWindow;
    40 import javax.swing.SwingUtilities;
    40 import javax.swing.SwingUtilities;
    41 import java.awt.BorderLayout;
    41 import java.awt.*;
    42 import java.awt.Color;
       
    43 import java.awt.event.ActionEvent;
    42 import java.awt.event.ActionEvent;
    44 import java.awt.event.MouseAdapter;
    43 import java.awt.event.MouseAdapter;
    45 import java.awt.event.MouseEvent;
    44 import java.awt.event.MouseEvent;
       
    45 import static java.awt.GraphicsDevice.WindowTranslucency.*;
    46 
    46 
    47 public class bug7160604 extends JApplet {
    47 public class bug7160604 extends JApplet {
    48 
    48 
    49     public void init() {
    49     public void init() {
    50         SwingUtilities.invokeLater(() -> {
    50         SwingUtilities.invokeLater(() -> {
       
    51             if (!GraphicsEnvironment
       
    52                     .getLocalGraphicsEnvironment()
       
    53                     .getDefaultScreenDevice()
       
    54                     .isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
       
    55                 // Tested translucency is not supported. Test passed
       
    56                 return;
       
    57             }
       
    58 
    51             final JWindow window = new JWindow();
    59             final JWindow window = new JWindow();
    52             window.setLocation(200, 200);
    60             window.setLocation(200, 200);
    53             window.setSize(300, 300);
    61             window.setSize(300, 300);
    54 
    62 
    55             final JLabel label = new JLabel("...click to invoke JPopupMenu");
    63             final JLabel label = new JLabel("...click to invoke JPopupMenu");