< prev index next >

test/jdk/java/awt/List/KeyEventsTest/KeyEventsTest.java

Print this page

        

@@ -20,34 +20,27 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /*
-  test
+  @test
+  @key headful
   @bug 6190768 6190778
-  @summary Tests that triggering events on AWT list by pressing CTRL + HOME, CTRL + END, PG-UP, PG-DOWN similar Motif behavior
-  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @summary Tests that triggering events on AWT list by pressing CTRL + HOME,
+           CTRL + END, PG-UP, PG-DOWN similar Motif behavior
   @library /test/lib
   @build jdk.test.lib.Platform
-  @run applet KeyEventsTest.html
+  @run main KeyEventsTest
 */
 
-/**
- * KeyEventsTest.html
- *
- * summary:
- */
-
-import java.applet.Applet;
 import java.awt.*;
 import java.awt.event.*;
-import java.util.Set;
 import java.lang.reflect.*;
 
 import jdk.test.lib.Platform;
 
-public class KeyEventsTest extends Applet implements ItemListener, FocusListener, KeyListener
+public class KeyEventsTest extends Frame implements ItemListener, FocusListener, KeyListener
 {
     TestState currentState;
     final Object LOCK = new Object();
     final int ACTION_TIMEOUT = 500;
 

@@ -55,10 +48,16 @@
     List multiple = new List(3, true);
 
     Panel p1 = new Panel ();
     Panel p2 = new Panel ();
 
+    public static void main(final String[] args) {
+        KeyEventsTest app = new KeyEventsTest();
+        app.init();
+        app.start();
+    }
+
     public void init()
     {
         setLayout (new BorderLayout ());
 
         single.add("0");

@@ -98,30 +97,24 @@
     public void start ()
     {
 
         try{
             setSize (200,200);
-            setVisible(true);
             validate();
+            setUndecorated(true);
+            setLocationRelativeTo(null);
+            setVisible(true);
 
-            main(null);
-
+            doTest();
+            System.out.println("Test passed.");
         } catch (Exception e) {
             e.printStackTrace();
             throw new RuntimeException("The test failed.");
         }
 
     }// start()
 
-    private void main(String[] args)
-      throws InterruptedException, InvocationTargetException {
-
-        doTest();
-
-        System.out.println("Test passed.");
-    }
-
     public void itemStateChanged (ItemEvent ie) {
         System.out.println("itemStateChanged-"+ie);
         this.currentState.setAction(true);
     }
 
< prev index next >