
// Generic AppletFrame

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;

// Applet to Application Frame window
public class SpheresAppletFrame extends Frame {

	public static void startApplet(String className, String title, String args[]) {
		SpheresApplet a;
		Dimension appletSize;

		// create new application frame window
		SpheresAppletFrame f = new SpheresAppletFrame(title);


		a = new SpheresApplet(true);

		// initialize the applet
	
		// 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);

		a.init();

		// show the window
		f.show();

		a.start();
	
	}  // end startApplet()


	// constructor needed to pass window title to class Frame
	public SpheresAppletFrame(String name) {
		// call java.awt.Frame(String) constructor
		super(name);
		addWindowListener(new JustCloseWindowAdapter());
		
		
	}

	class JustCloseWindowAdapter extends WindowAdapter{
	
		public void windowClosing(WindowEvent e){
			dispose();
			}
		}

}   // end class AppletFrame

