8081311: [TEST_BUG] java/awt/ComponentOrientation/WindowTest.java does use deprecated applyResourceBundle
authoraghaisas
Mon, 25 Sep 2017 16:06:13 +0530
changeset 47372 370a8cb82546
parent 47371 9318793bdc36
child 47373 791e7f39b45a
8081311: [TEST_BUG] java/awt/ComponentOrientation/WindowTest.java does use deprecated applyResourceBundle Reviewed-by: serb, ssadetsky Contributed-by: pankaj.b.bansal@oracle.com
test/jdk/java/awt/ComponentOrientation/WindowTest.java
--- a/test/jdk/java/awt/ComponentOrientation/WindowTest.java	Mon Sep 25 15:57:43 2017 +0530
+++ b/test/jdk/java/awt/ComponentOrientation/WindowTest.java	Mon Sep 25 16:06:13 2017 +0530
@@ -32,46 +32,38 @@
  * @run main WindowTest
  */
 
-import java.awt.*;
-import java.applet.*;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.FlowLayout;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
-public class WindowTest extends Applet {
-    static Exception failure=null;
-    static Thread mainThread=null;
+public class WindowTest {
 
     public static void main(String args[]) throws Exception {
-        mainThread = Thread.currentThread();
-        WindowTest app = new WindowTest();
-        app.start();
+        Frame frame  = new Frame();
+        frame.setSize(200,200);
+        frame.setVisible(true);
         try {
-            Thread.sleep(300000);
-        } catch (InterruptedException e) {
-            if (failure != null) {
-                throw failure;
-            }
+            doTest(frame);
+        } finally {
+            frame.setVisible(false);
+            frame.dispose();
         }
     }
 
-    public void start() {
-        try {
-            doTest();
-        } catch (Exception e) {
-            failure = e;
-        }
-        mainThread.interrupt();
-    }
-
-    public void doTest() {
+    public static void doTest (Frame  myFrame) throws Exception{
         System.out.println("WindowTest {");
 
         ResourceBundle rb;
-        Frame myFrame;
 
         // Create a window containing a hierarchy of components.
         System.out.println("  Creating component hierarchy...");
-        myFrame = new Frame();
         myFrame.setLayout(new FlowLayout());
         Panel panel1 = new Panel();
         panel1.setLayout(new BorderLayout());
@@ -115,9 +107,6 @@
         myFrame.applyResourceBundle(rb);
         verifyOrientation(myFrame, ComponentOrientation.LEFT_TO_RIGHT);
 
-
-        myFrame.setVisible(false);
-        myFrame.dispose();
         System.out.println("}");
     }