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 4199622
28 @requires (os.family == "windows")
29 @summary RFE: JComboBox shouldn't send ActionEvents for keyboard navigation
30 @author Vladislav Karnaukhov
31 @library ../../../../lib/testlibrary
32 @modules java.desktop/com.sun.java.swing.plaf.windows
33 @build jdk.testlibrary.OSInfo
34 @run main bug4199622
35 */
36
37 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
38 import jdk.testlibrary.OSInfo;
39
40 import javax.swing.*;
41 import javax.swing.plaf.metal.MetalLookAndFeel;
42 import java.awt.*;
43 import java.awt.event.ActionEvent;
44 import java.awt.event.ActionListener;
45 import java.awt.event.KeyEvent;
46 import java.lang.reflect.InvocationTargetException;
47
48 public class bug4199622 extends JFrame implements ActionListener {
49
50 static final int nElems = 20;
51 static JComboBox<String> cb = null;
52
53 bug4199622(LookAndFeel laf) {
54 super();
55
56 try {
57 UIManager.setLookAndFeel(laf);
58 } catch (UnsupportedLookAndFeelException e) {
212 robot.waitForIdle();
213 }
214 }
215
216 public static void main(String[] args) {
217 try {
218 SwingUtilities.invokeAndWait(new Runnable() {
219 @Override
220 public void run() {
221 bug4199622 test = new bug4199622(new MetalLookAndFeel());
222 test.setVisible(true);
223 }
224 });
225 } catch (InterruptedException e) {
226 throw new RuntimeException("Test failed", e);
227 } catch (InvocationTargetException e) {
228 throw new RuntimeException("Test failed", e);
229 }
230 doTest();
231
232 if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
233 try {
234 SwingUtilities.invokeAndWait(new Runnable() {
235 @Override
236 public void run() {
237 bug4199622 test = new bug4199622(new WindowsLookAndFeel());
238 test.setVisible(true);
239 }
240 });
241 } catch (InterruptedException e) {
242 throw new RuntimeException("Test failed", e);
243 } catch (InvocationTargetException e) {
244 throw new RuntimeException("Test failed", e);
245 }
246 doTest();
247 }
248 }
249 }
|
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 4199622
28 @requires (os.family == "windows")
29 @summary RFE: JComboBox shouldn't send ActionEvents for keyboard navigation
30 @author Vladislav Karnaukhov
31 @library /test/lib
32 @modules java.desktop/com.sun.java.swing.plaf.windows
33 @build jdk.test.libr.Platform
34 @run main bug4199622
35 */
36
37 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
38 import jdk.test.lib.Platform;
39
40 import javax.swing.*;
41 import javax.swing.plaf.metal.MetalLookAndFeel;
42 import java.awt.*;
43 import java.awt.event.ActionEvent;
44 import java.awt.event.ActionListener;
45 import java.awt.event.KeyEvent;
46 import java.lang.reflect.InvocationTargetException;
47
48 public class bug4199622 extends JFrame implements ActionListener {
49
50 static final int nElems = 20;
51 static JComboBox<String> cb = null;
52
53 bug4199622(LookAndFeel laf) {
54 super();
55
56 try {
57 UIManager.setLookAndFeel(laf);
58 } catch (UnsupportedLookAndFeelException e) {
212 robot.waitForIdle();
213 }
214 }
215
216 public static void main(String[] args) {
217 try {
218 SwingUtilities.invokeAndWait(new Runnable() {
219 @Override
220 public void run() {
221 bug4199622 test = new bug4199622(new MetalLookAndFeel());
222 test.setVisible(true);
223 }
224 });
225 } catch (InterruptedException e) {
226 throw new RuntimeException("Test failed", e);
227 } catch (InvocationTargetException e) {
228 throw new RuntimeException("Test failed", e);
229 }
230 doTest();
231
232 if (Platform.isWindows()) {
233 try {
234 SwingUtilities.invokeAndWait(new Runnable() {
235 @Override
236 public void run() {
237 bug4199622 test = new bug4199622(new WindowsLookAndFeel());
238 test.setVisible(true);
239 }
240 });
241 } catch (InterruptedException e) {
242 throw new RuntimeException("Test failed", e);
243 } catch (InvocationTargetException e) {
244 throw new RuntimeException("Test failed", e);
245 }
246 doTest();
247 }
248 }
249 }
|