1 /*
2 * Copyright (c) 2013, 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 */
25 import java.awt.Toolkit;
26 import java.awt.event.ItemEvent;
27 import java.awt.event.ItemListener;
28 import javax.swing.ComboBoxEditor;
29 import javax.swing.JComboBox;
30 import javax.swing.JFrame;
31 import javax.swing.JTextField;
32 import javax.swing.UIManager;
33 import sun.awt.SunToolkit;
34
35 import static javax.swing.SwingUtilities.invokeAndWait;
36 import static javax.swing.SwingUtilities.windowForComponent;
37 import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
38
39 /*
40 * @test
41 * @bug 8015300
42 * @summary Tests that editable combobox select all text
43 * @author Sergey Malenkov
44 * @library ../../../../lib/testlibrary/
45 * @build ExtendedRobot
46 * @run main Test8015300
47 */
48
49 public class Test8015300 {
50 private static final ExtendedRobot robot = createRobot();
51 private static final String[] ITEMS = {
52 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
53 "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
54
55 private static JComboBox<String> combo;
56
57 public static void main(String[] args) throws Exception {
58 UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
59 for (UIManager.LookAndFeelInfo info : array) {
60 UIManager.setLookAndFeel(info.getClassName());
61 System.err.println("L&F: " + info.getName());
62 invokeAndWait(new Runnable() {
63 @Override
64 public void run() {
|
1 /*
2 * Copyright (c) 2013, 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 */
25 import java.awt.Toolkit;
26 import java.awt.event.ItemEvent;
27 import java.awt.event.ItemListener;
28 import javax.swing.ComboBoxEditor;
29 import javax.swing.JComboBox;
30 import javax.swing.JFrame;
31 import javax.swing.JTextField;
32 import javax.swing.UIManager;
33 import sun.awt.SunToolkit;
34
35 import static javax.swing.SwingUtilities.invokeAndWait;
36 import static javax.swing.SwingUtilities.windowForComponent;
37 import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
38
39 /*
40 * @test
41 * @bug 8015300
42 * @summary Tests that editable combobox select all text
43 * @author Sergey Malenkov
44 * @library ../../../../lib/testlibrary/
45 * @modules java.desktop/com.sun.java.swing.plaf.windows
46 * @build ExtendedRobot
47 * @run main Test8015300
48 */
49
50 public class Test8015300 {
51 private static final ExtendedRobot robot = createRobot();
52 private static final String[] ITEMS = {
53 "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
54 "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
55
56 private static JComboBox<String> combo;
57
58 public static void main(String[] args) throws Exception {
59 UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
60 for (UIManager.LookAndFeelInfo info : array) {
61 UIManager.setLookAndFeel(info.getClassName());
62 System.err.println("L&F: " + info.getName());
63 invokeAndWait(new Runnable() {
64 @Override
65 public void run() {
|