Package

Source Code of Hybrid

import java.applet.Applet;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/* This class is thanks to mindprod.com
  Source: http://mindprod.com/jgloss/applet.html#OBJECT
*/
public class Hybrid
{

    public static void fireup(
        final Applet applet,
        final String title,
        final int applicationWidth,
        final int applicationHeight )
    {
        final Frame frame = new Frame(title);
        frame.setSize( applicationWidth, applicationHeight );
        frame.addWindowListener( new WindowAdapter()
            {
                /**
                 * Handle request to shutdown.
                 * @param e event giving details of closing.
                 */
                public void windowClosing(WindowEvent e)
                {
                    applet.stop();
                    applet.destroy();
                    System.exit(0);
                }
            }
            );
        frame.add( applet );
        applet.init();
        frame.validate();
        frame.setVisible(true);
        applet.start();
    }
}
TOP

Related Classes of Hybrid

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.