4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 @bug 8041470
26 @summary JButtons stay pressed after they have lost focus if you use the mouse wheel
27 @author Anton Nashatyrev
28 */
29 import javax.swing.*;
30 import java.awt.*;
31 import java.awt.event.*;
32 import java.util.concurrent.CountDownLatch;
33
34 public class WheelModifier {
35
36 JFrame f;
37 JButton fb;
38
39 CountDownLatch pressSema = new CountDownLatch(1);
40 CountDownLatch exitSema = new CountDownLatch(1);
41 CountDownLatch releaseSema = new CountDownLatch(1);
42 volatile CountDownLatch wheelSema;
43
44 void createGui() {
45 f = new JFrame("frame");
46 fb = new JButton("frame_button");
47 fb.addMouseListener(new MouseAdapter() {
48 @Override
|
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 @test
26 @key headful
27 @bug 8041470
28 @summary JButtons stay pressed after they have lost focus if you use the mouse wheel
29 @author Anton Nashatyrev
30 */
31
32 import javax.swing.*;
33 import java.awt.*;
34 import java.awt.event.*;
35 import java.util.concurrent.CountDownLatch;
36
37 public class WheelModifier {
38
39 JFrame f;
40 JButton fb;
41
42 CountDownLatch pressSema = new CountDownLatch(1);
43 CountDownLatch exitSema = new CountDownLatch(1);
44 CountDownLatch releaseSema = new CountDownLatch(1);
45 volatile CountDownLatch wheelSema;
46
47 void createGui() {
48 f = new JFrame("frame");
49 fb = new JButton("frame_button");
50 fb.addMouseListener(new MouseAdapter() {
51 @Override
|