< prev index next >

test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java

Print this page

        

@@ -20,26 +20,26 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /*
-  test
+  @test
+  @key headful
   @bug       6396785
   @summary   Action key pressed on a button should be swallowed.
-  @author    anton.tarasov@...: area=awt.focus
-  @run       applet ButtonActionKeyTest.html
+  @library    ../../../regtesthelpers
+  @build      Util
+  @run        main ButtonActionKeyTest
 */
 
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import java.applet.Applet;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.lang.reflect.InvocationTargetException;
 import test.java.awt.regtesthelpers.Util;
 
-public class ButtonActionKeyTest extends Applet {
+public class ButtonActionKeyTest {
     Robot robot;
     JFrame frame = new JFrame("Frame");
     JButton button = new JButton("button");
     JTextField text = new JTextField("text");
     AtomicBoolean gotEvent = new AtomicBoolean(false);

@@ -50,15 +50,10 @@
         app.start();
     }
 
     public void init() {
         robot = Util.createRobot();
-
-        // Create instructions for the user here, as well as set up
-        // the environment -- set the layout manager, add buttons,
-        // etc.
-        this.setLayout (new BorderLayout ());
     }
 
     public void start() {
         frame.setLayout(new FlowLayout());
         frame.add(button);

@@ -82,11 +77,11 @@
                             gotEvent.notifyAll();
                         }
                     }
                 }
             });
-
+        frame.setLocationRelativeTo(null);
         frame.setVisible(true);
         Util.waitForIdle(robot);
 
         Util.clickOnComp(button, robot);
         Util.waitForIdle(robot);
< prev index next >