author | goetz |
Tue, 09 Dec 2014 11:57:46 +0100 | |
changeset 28187 | fc19df82d6ee |
parent 23010 | 6dadb192ad81 |
child 28071 | 3acb75b8df45 |
permissions | -rw-r--r-- |
11664
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
11664
diff
changeset
|
2 |
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
11664
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
4 |
* |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
8 |
* |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
13 |
* accompanied this code). |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
14 |
* |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
18 |
* |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
21 |
* questions. |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
22 |
*/ |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
23 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
24 |
/* |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
25 |
* @test |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
26 |
* @bug 4966112 |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
27 |
* @summary Some Composite components does not show the Context Popup. |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
28 |
* @library ../../regtesthelpers |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
29 |
* @build Util |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
30 |
* @author Alexander Zuev |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
31 |
* @run main bug4966112 |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
32 |
*/ |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
33 |
import javax.swing.*; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
34 |
import javax.swing.event.PopupMenuListener; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
35 |
import javax.swing.event.PopupMenuEvent; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
36 |
import java.awt.*; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
37 |
import java.awt.event.*; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
38 |
import sun.awt.SunToolkit; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
39 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
40 |
public class bug4966112 { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
41 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
42 |
private static final int NO_MOUSE_BUTTON = -1; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
43 |
private static volatile boolean shown = false; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
44 |
private static volatile int popupButton = NO_MOUSE_BUTTON; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
45 |
private static volatile JButton testButton; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
46 |
private static volatile JSplitPane jsp; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
47 |
private static volatile JSpinner spin; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
48 |
private static volatile JFileChooser filec; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
49 |
private static int buttonMask; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
50 |
private static Robot robot; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
51 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
52 |
public static void main(String[] args) throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
53 |
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
54 |
robot = new Robot(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
55 |
robot.setAutoDelay(100); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
56 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
57 |
createAndShowButton(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
58 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
59 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
60 |
setClickPoint(testButton); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
61 |
clickMouse(InputEvent.BUTTON1_MASK); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
62 |
clickMouse(InputEvent.BUTTON2_MASK); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
63 |
clickMouse(InputEvent.BUTTON3_MASK); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
64 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
65 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
66 |
closeFrame(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
67 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
68 |
if (popupButton == NO_MOUSE_BUTTON) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
69 |
System.out.println("Test can't identify the popup trigger button. Test skipped"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
70 |
return; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
71 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
72 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
73 |
setButtonMask(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
74 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
75 |
// Test Split Pane |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
76 |
createAndShowSplitPane(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
77 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
78 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
79 |
clickMouse(jsp); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
80 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
81 |
closeFrame(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
82 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
83 |
if (!shown) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
84 |
throw new RuntimeException("Popup was not shown on splitpane"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
85 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
86 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
87 |
// Test Spinner |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
88 |
createAndShowSpinner(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
89 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
90 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
91 |
clickMouse(spin); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
92 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
93 |
closeFrame(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
94 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
95 |
if (!shown) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
96 |
throw new RuntimeException("Popup was not shown on spinner"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
97 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
98 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
99 |
// Test File Chooser |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
100 |
createAndShowFileChooser(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
101 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
102 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
103 |
clickMouse(filec); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
104 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
105 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
106 |
Util.hitKeys(robot, KeyEvent.VK_ESCAPE); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
107 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
108 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
109 |
Util.hitKeys(robot, KeyEvent.VK_ESCAPE); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
110 |
toolkit.realSync(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
111 |
closeFrame(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
112 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
113 |
if (!shown) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
114 |
throw new RuntimeException("Popup was not shown on filechooser"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
115 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
116 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
117 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
118 |
private static void clickMouse(JComponent c) throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
119 |
setClickPoint(c); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
120 |
clickMouse(buttonMask); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
121 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
122 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
123 |
private static void clickMouse(int buttons) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
124 |
robot.mousePress(buttons); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
125 |
robot.mouseRelease(buttons); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
126 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
127 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
128 |
private static void setButtonMask() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
129 |
switch (popupButton) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
130 |
case MouseEvent.BUTTON1: |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
131 |
buttonMask = InputEvent.BUTTON1_MASK; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
132 |
break; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
133 |
case MouseEvent.BUTTON2: |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
134 |
buttonMask = InputEvent.BUTTON2_MASK; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
135 |
break; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
136 |
case MouseEvent.BUTTON3: |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
137 |
buttonMask = InputEvent.BUTTON3_MASK; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
138 |
break; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
139 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
140 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
141 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
142 |
private static void setClickPoint(final JComponent c) throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
143 |
final Point[] result = new Point[1]; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
144 |
SwingUtilities.invokeAndWait(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
145 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
146 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
147 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
148 |
Point p = c.getLocationOnScreen(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
149 |
Dimension size = c.getSize(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
150 |
result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
151 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
152 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
153 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
154 |
robot.mouseMove(result[0].x, result[0].y); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
155 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
156 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
157 |
private static JPopupMenu createJPopupMenu() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
158 |
JPopupMenu jpm = new JPopupMenu(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
159 |
jpm.add("One"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
160 |
jpm.add("Two"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
161 |
jpm.add("Three"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
162 |
jpm.addPopupMenuListener(new PopupMenuListener() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
163 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
164 |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
165 |
shown = true; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
166 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
167 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
168 |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
169 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
170 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
171 |
public void popupMenuCanceled(PopupMenuEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
172 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
173 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
174 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
175 |
AutoClosable.INSTANCE.setPopup(jpm); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
176 |
return jpm; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
177 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
178 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
179 |
private static void createAndShowButton() throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
180 |
SwingUtilities.invokeAndWait(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
181 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
182 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
183 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
184 |
JFrame frame = new JFrame("Button Frame"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
185 |
frame.setLayout(new BorderLayout()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
186 |
testButton = new JButton("Popup Tester"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
187 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
188 |
testButton.addMouseListener(new MouseAdapter() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
189 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
190 |
void setPopupTrigger(MouseEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
191 |
if (e.isPopupTrigger()) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
192 |
popupButton = e.getButton(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
193 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
194 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
195 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
196 |
public void mouseClicked(MouseEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
197 |
setPopupTrigger(e); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
198 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
199 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
200 |
public void mousePressed(MouseEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
201 |
setPopupTrigger(e); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
202 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
203 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
204 |
public void mouseReleased(MouseEvent e) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
205 |
setPopupTrigger(e); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
206 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
207 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
208 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
209 |
frame.add(testButton, BorderLayout.CENTER); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
210 |
frame.pack(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
211 |
frame.setVisible(true); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
212 |
AutoClosable.INSTANCE.setFrame(frame); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
213 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
214 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
215 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
216 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
217 |
private static void createAndShowSplitPane() throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
218 |
SwingUtilities.invokeAndWait(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
219 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
220 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
221 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
222 |
JFrame frame = new JFrame("Test SplitPane"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
223 |
frame.setSize(250, 200); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
224 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
225 |
frame.setLayout(new BorderLayout()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
226 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
227 |
shown = false; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
228 |
jsp = new JSplitPane(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
229 |
jsp.setRightComponent(new JPanel()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
230 |
jsp.setLeftComponent(new JPanel()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
231 |
jsp.setComponentPopupMenu(createJPopupMenu()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
232 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
233 |
frame.add(jsp, BorderLayout.CENTER); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
234 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
235 |
jsp.setDividerLocation(150); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
236 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
237 |
frame.setLocation(400, 300); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
238 |
frame.setVisible(true); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
239 |
AutoClosable.INSTANCE.setFrame(frame); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
240 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
241 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
242 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
243 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
244 |
private static void createAndShowSpinner() throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
245 |
SwingUtilities.invokeAndWait(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
246 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
247 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
248 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
249 |
JFrame frame = new JFrame("JSpinner Test"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
250 |
frame.setLayout(new BorderLayout()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
251 |
frame.setSize(200, 100); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
252 |
shown = false; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
253 |
spin = new JSpinner(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
254 |
spin.setComponentPopupMenu(createJPopupMenu()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
255 |
frame.add(spin, BorderLayout.CENTER); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
256 |
frame.setVisible(true); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
257 |
AutoClosable.INSTANCE.setFrame(frame); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
258 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
259 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
260 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
261 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
262 |
private static void createAndShowFileChooser() throws Exception { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
263 |
SwingUtilities.invokeLater(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
264 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
265 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
266 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
267 |
JFrame frame = new JFrame("FileChooser test dialog"); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
268 |
frame.setSize(100, 100); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
269 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
270 |
shown = false; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
271 |
filec = new JFileChooser(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
272 |
filec.setComponentPopupMenu(createJPopupMenu()); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
273 |
filec.showOpenDialog(frame); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
274 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
275 |
frame.setVisible(true); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
276 |
AutoClosable.INSTANCE.setFrame(frame); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
277 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
278 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
279 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
280 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
281 |
private static void closeFrame() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
282 |
SwingUtilities.invokeLater(new Runnable() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
283 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
284 |
@Override |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
285 |
public void run() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
286 |
AutoClosable.INSTANCE.close(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
287 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
288 |
}); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
289 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
290 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
291 |
private static class AutoClosable { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
292 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
293 |
static final AutoClosable INSTANCE = new AutoClosable(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
294 |
private JFrame frame; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
295 |
private JPopupMenu popup; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
296 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
297 |
public void setFrame(JFrame frame) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
298 |
this.frame = frame; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
299 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
300 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
301 |
public void setPopup(JPopupMenu popup) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
302 |
this.popup = popup; |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
303 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
304 |
|
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
305 |
public void close() { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
306 |
frame.dispose(); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
307 |
if (popup != null) { |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
308 |
popup.setVisible(false); |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
309 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
310 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
311 |
} |
5e4b10294666
7105040: [macosx] closed/javax/swing/JPopupMenu/4966112/bug4966112.java deadlocks on MacOS
alexsch
parents:
diff
changeset
|
312 |
} |