< prev index next >

test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java

Print this page

        

@@ -18,26 +18,24 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 /*
-  test
+  @test
+  @key headful
   @bug       6391688
   @summary   Tests that next mnemonic KeyTyped is consumed for a modal dialog.
-  @author    anton.tarasov@sun.com: area=awt.focus
-  @run       applet ConsumeForModalDialogTest.html
+  @run        main ConsumeForModalDialogTest
 */
 
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
-import java.applet.Applet;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.lang.reflect.InvocationTargetException;
 
-public class ConsumeForModalDialogTest extends Applet {
+public class ConsumeForModalDialogTest {
     Robot robot;
     JFrame frame = new JFrame("Test Frame");
     JDialog dialog = new JDialog((Window)null, "Test Dialog", Dialog.ModalityType.DOCUMENT_MODAL);
     JTextField text = new JTextField();
     static boolean passed = true;

@@ -53,14 +51,10 @@
             robot = new Robot();
             robot.setAutoDelay(50);
         } catch (AWTException e) {
             throw new RuntimeException("Error: unable to create robot", e);
         }
-        // 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() {
 
         text.addKeyListener(new KeyAdapter() {

@@ -91,10 +85,11 @@
         dialog.setSize(100, 100);
         dialog.add(text);
 
         frame.setJMenuBar(menuBar);
         frame.setSize(100, 100);
+        frame.setLocationRelativeTo(null);
         frame.setVisible(true);
 
         robot.waitForIdle();
 
         if (!frame.isFocusOwner()) {
< prev index next >