author | dbuck |
Tue, 18 Aug 2015 04:29:28 -0700 | |
changeset 32417 | 6859107fc6c3 |
parent 23010 | 6dadb192ad81 |
child 39056 | d99e63b6d962 |
permissions | -rw-r--r-- |
13238
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
21596
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
13238
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
4 |
* |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
21596 | 7 |
* published by the Free Software Foundation. |
13238
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
8 |
* |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
14 |
* |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
18 |
* |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
21 |
* questions. |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
22 |
*/ |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
23 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
24 |
import java.awt.Frame; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
25 |
import java.awt.event.InputEvent; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
26 |
import java.awt.event.MouseEvent; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
27 |
import java.awt.event.MouseWheelEvent; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
28 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
29 |
import javax.swing.SwingUtilities; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
30 |
import javax.swing.event.MenuDragMouseEvent; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
31 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
32 |
/** |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
33 |
* @test |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
34 |
* @bug 7170657 |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
35 |
* @author Sergey Bylokhov |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
36 |
*/ |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
37 |
public final class bug7170657 { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
38 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
39 |
private static boolean FAILED; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
40 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
41 |
public static void main(final String[] args) { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
42 |
final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
43 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
44 |
Frame f = new Frame(); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
45 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
46 |
MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true, |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
47 |
1, 1, 1); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
48 |
MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
49 |
true, null, null); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
50 |
MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true, |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
51 |
MouseEvent.NOBUTTON); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
52 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
53 |
test(f, mwe); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
54 |
test(f, mdme); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
55 |
test(f, me); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
56 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
57 |
if (FAILED) { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
58 |
throw new RuntimeException("Wrong mouse event"); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
59 |
} |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
60 |
} |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
61 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
62 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
63 |
private static void test(final Frame frame, final MouseEvent me) { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
64 |
MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
65 |
if (me.getModifiersEx() != newme.getModifiersEx() |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
66 |
|| me.getModifiers() != newme.getModifiers()) { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
67 |
fail(me, newme); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
68 |
} |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
69 |
} |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
70 |
|
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
71 |
private static void fail(final MouseEvent exp, final MouseEvent act) { |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
72 |
System.err.println("Expected: " + exp); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
73 |
System.err.println("Actual: " + act); |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
74 |
FAILED = true; |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
75 |
} |
b045f9da27b2
7170657: [macosx] There seems to be no keyboard/mouse action to select non-contiguous items in List
serb
parents:
diff
changeset
|
76 |
} |