1 /*
2 * Copyright (c) 2012, 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 /* @test 1.0 04/04/23
25 @bug 5012888
26 @summary REGRESSION: Click & hold on arrow of JSpinner only transfers focus
27 @author Konstantin Eremin
28 @run main bug5012888
29 */
30 import javax.swing.*;
31 import javax.swing.event.*;
32 import java.awt.*;
33 import java.awt.event.*;
34
35 public class bug5012888 extends JFrame {
36 JSpinner spinner1, spinner2;
37 public bug5012888() {
38 spinner1 = new JSpinner(new SpinnerNumberModel(0, -1000, 1000, 1));
39 spinner2 = new JSpinner(new SpinnerNumberModel(1, -1000, 1000, 1));
40 Container pane = getContentPane();
41 pane.setLayout(new BorderLayout());
42 pane.add(spinner1, BorderLayout.NORTH);
43 pane.add(spinner2, BorderLayout.SOUTH);
44 }
45 public void doTest() throws Exception {
46 ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
47 Point p = spinner2.getLocationOnScreen();
48 Rectangle rect = spinner2.getBounds();
49 Robot robot = new Robot();
|
1 /*
2 * Copyright (c) 2012, 2016, 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 /*
25 * @test 1.0 04/04/23
26 * @key headful
27 * @bug 5012888
28 * @summary REGRESSION: Click & hold on arrow of JSpinner only transfers focus
29 * @author Konstantin Eremin
30 * @run main bug5012888
31 */
32
33 import javax.swing.*;
34 import javax.swing.event.*;
35 import java.awt.*;
36 import java.awt.event.*;
37
38 public class bug5012888 extends JFrame {
39 JSpinner spinner1, spinner2;
40 public bug5012888() {
41 spinner1 = new JSpinner(new SpinnerNumberModel(0, -1000, 1000, 1));
42 spinner2 = new JSpinner(new SpinnerNumberModel(1, -1000, 1000, 1));
43 Container pane = getContentPane();
44 pane.setLayout(new BorderLayout());
45 pane.add(spinner1, BorderLayout.NORTH);
46 pane.add(spinner2, BorderLayout.SOUTH);
47 }
48 public void doTest() throws Exception {
49 ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
50 Point p = spinner2.getLocationOnScreen();
51 Rectangle rect = spinner2.getBounds();
52 Robot robot = new Robot();
|