package ip.gui.frames;
import java.applet.Applet;
import java.awt.*;
public class AppletFrame extends ClosableFrame {
public static void startApplet(Applet a) {
Dimension appletSize;
AppletFrame f = new AppletFrame("Applet Frame");
f.add("Center", a);
f.pack();
a.init();
a.start();
appletSize = a.getSize();
f.setSize(appletSize);
f.show();
}
public static void startApplet(String className) {
String args[] = {""};
startApplet(
className,
className,
args);
}
public static void startApplet(String className,
String title, String args[]) {
Applet a;
Dimension appletSize;
try {
a = (Applet) Class.forName(className).newInstance();
} catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundException in AppletFrame");
return;
} catch (InstantiationException e) {
System.out.println("InstantiationException in AppletFrame");
return;
} catch (IllegalAccessException e) {
System.out.println("IllegalAccessException in AppletFrame");
return;
}
a.init();
a.start();
AppletFrame f = new AppletFrame(title);
f.add("Center", a);
appletSize = a.getSize();
f.pack();
f.setSize(appletSize);
f.setSize(200, 200);
f.show();
}
public AppletFrame(String name) {
super(name);
}
}