< prev index next >

test/jdk/java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -24,28 +24,19 @@
 /*
   @test
   @key headful
   @bug      4782886
   @summary  FocusManager consumes wrong KEY_TYPED events
-  @author   Oleg.Sukhodolsky: area=awt.focus
   @library  ../../regtesthelpers
   @build    Util
   @run      main WrongKeyTypedConsumedTest
 */
 
-import java.applet.Applet;
-import java.awt.AWTException;
 import java.awt.AWTKeyStroke;
 import java.awt.BorderLayout;
-import java.awt.Dialog;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Frame;
 import java.awt.KeyboardFocusManager;
-import java.awt.Point;
 import java.awt.Robot;
-import java.awt.TextArea;
 
 import java.awt.event.KeyEvent;
 
 import java.util.HashSet;
 import java.util.Set;

@@ -54,25 +45,21 @@
 import javax.swing.JFrame;
 import javax.swing.JTextArea;
 
 import test.java.awt.regtesthelpers.Util;
 
-public class WrongKeyTypedConsumedTest extends Applet
+public class WrongKeyTypedConsumedTest
 {
     Robot robot = Util.createRobot();
 
     public static void main(String[] args) {
         WrongKeyTypedConsumedTest test = new WrongKeyTypedConsumedTest();
         test.start();
     }
 
     public void start ()
     {
-        setSize (200,200);
-        setVisible(true);
-        validate();
-
         JFrame frame = new JFrame("The Frame");
         Set ftk = new HashSet();
         ftk.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DOWN, 0));
         frame.getContentPane().
             setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,

@@ -83,10 +70,11 @@
 
         JTextArea textarea = new JTextArea(40, 10);
         frame.getContentPane().add(textarea);
 
         frame.pack();
+        frame.setLocationRelativeTo(null);
         frame.setVisible(true);
         Util.waitForIdle(robot);
 
         if (!frame.isActive()) {
             throw new RuntimeException("Test Fialed: frame isn't active");
< prev index next >