jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java
changeset 8970 9e16ce7c2da2
parent 5506 202f599c92aa
child 10292 ed7db6a12c2a
--- a/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java	Fri Mar 25 17:52:51 2011 +0100
+++ b/jdk/src/share/demo/applets/GraphicsTest/AppletFrame.java	Fri Mar 25 17:55:34 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -29,8 +29,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/*
- */
 
 import java.awt.Frame;
 import java.awt.Event;
@@ -38,66 +36,67 @@
 import java.applet.Applet;
 import java.awt.AWTEvent;
 
-// Applet to Application Frame window
-class AppletFrame extends Frame
-{
+
+/**
+ * Applet to Application Frame window
+ */
+@SuppressWarnings("serial")
+class AppletFrame extends Frame {
 
     public static void startApplet(String className,
-                                   String title,
-                                   String args[])
-    {
-       // local variables
-       Applet a;
-       Dimension appletSize;
+            String title,
+            String args[]) {
+        // local variables
+        Applet a;
+        Dimension appletSize;
 
-       try
-       {
-          // create an instance of your applet class
-          a = (Applet) Class.forName(className).newInstance();
-       }
-       catch (ClassNotFoundException e) { return; }
-       catch (InstantiationException e) { return; }
-       catch (IllegalAccessException e) { return; }
+        try {
+            // create an instance of your applet class
+            a = (Applet) Class.forName(className).newInstance();
+        } catch (ClassNotFoundException e) {
+            return;
+        } catch (InstantiationException e) {
+            return;
+        } catch (IllegalAccessException e) {
+            return;
+        }
 
-       // initialize the applet
-       a.init();
-       a.start();
+        // initialize the applet
+        a.init();
+        a.start();
 
-       // create new application frame window
-       AppletFrame f = new AppletFrame(title);
+        // create new application frame window
+        AppletFrame f = new AppletFrame(title);
 
-       // add applet to frame window
-       f.add("Center", a);
+        // add applet to frame window
+        f.add("Center", a);
 
-       // resize frame window to fit applet
-       // assumes that the applet sets its own size
-       // otherwise, you should set a specific size here.
-       appletSize =  a.getSize();
-       f.pack();
-       f.setSize(appletSize);
+        // resize frame window to fit applet
+        // assumes that the applet sets its own size
+        // otherwise, you should set a specific size here.
+        appletSize = a.getSize();
+        f.pack();
+        f.setSize(appletSize);
 
-       // show the window
-       f.show();
+        // show the window
+        f.setVisible(true);
 
     }  // end startApplet()
 
-
     // constructor needed to pass window title to class Frame
-    public AppletFrame(String name)
-    {
-       // call java.awt.Frame(String) constructor
-       super(name);
+    public AppletFrame(String name) {
+        // call java.awt.Frame(String) constructor
+        super(name);
     }
 
     // needed to allow window close
-    public void processEvent(AWTEvent e)
-    {
-       // Window Destroy event
-       if (e.getID() == Event.WINDOW_DESTROY)
-       {
-          // exit the program
-          System.exit(0);
-       }
-   }  // end handleEvent()
+    @Override
+    public void processEvent(AWTEvent e) {
+        // Window Destroy event
+        if (e.getID() == Event.WINDOW_DESTROY) {
+            // exit the program
+            System.exit(0);
+        }
+    }  // end handleEvent()
+}   // end class AppletFrame
 
-}   // end class AppletFrame