1 /*
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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 import java.awt.*;
25 import java.awt.event.*;
26
27 /**
28 * @test
29 * @bug 4449139
30 * @summary test MouseWheelEvent generation by Scrollbar component
31 */
32 public final class ScrollbarMouseWheelTest
33 implements MouseWheelListener, WindowListener {
34
35 final static String tk = Toolkit.getDefaultToolkit().getClass().getName();
36 final static int REPS = 5;
37 // There is a bug on Windows: 4616935.
38 // Wheel events comes to every component in the hierarchy so we should
39 // check a platform.
40 // There are two scrollbars within one Panel and both accept 5 clicks, so
41 // Panel would accept 5*2 clicks on Windows.
42 final static int PANEL_REPS = tk.equals("sun.awt.windows.WToolkit")? REPS * 2: REPS;
43
44 Scrollbar sb1;
45 Scrollbar sb2;
46 Panel pnl;
47 class Sema {
48 boolean flag;
49 boolean getVal() { return flag;}
50 void setVal(boolean b) { flag = b;}
51 }
|
1 /*
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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 import java.awt.*;
25 import java.awt.event.*;
26
27 /**
28 * @test
29 * @key headful
30 * @bug 4449139
31 * @summary test MouseWheelEvent generation by Scrollbar component
32 */
33
34 public final class ScrollbarMouseWheelTest
35 implements MouseWheelListener, WindowListener {
36
37 final static String tk = Toolkit.getDefaultToolkit().getClass().getName();
38 final static int REPS = 5;
39 // There is a bug on Windows: 4616935.
40 // Wheel events comes to every component in the hierarchy so we should
41 // check a platform.
42 // There are two scrollbars within one Panel and both accept 5 clicks, so
43 // Panel would accept 5*2 clicks on Windows.
44 final static int PANEL_REPS = tk.equals("sun.awt.windows.WToolkit")? REPS * 2: REPS;
45
46 Scrollbar sb1;
47 Scrollbar sb2;
48 Panel pnl;
49 class Sema {
50 boolean flag;
51 boolean getVal() { return flag;}
52 void setVal(boolean b) { flag = b;}
53 }
|