With Swing applications I can use an external class to instantiate and view them.
I’d like to do the same with an Applet, outside of Eclipse, without using the appletviewer.
I want to be able to Run a class MyappletRunner and have its main method kick off the following applet for viewing.
Given the following source code:
import java.applet.*;
import java.awt.*;
public class Myapplet extends Applet{
String str;
public void init(){
str = "This is my first applet";
}
public void paint(Graphics g){
g.drawString(str, 50,50);
}
}
The basic idea is to create your own Swing
Frame, add the Applet to your frame, and then pass your Applet an instance of theAppletStubinterface.The best example of it appears to be here:
http://www.java2s.com/Code/JavaAPI/java.applet/implementsAppletStub.htm