import java.awt.*;
import java.applet.*;
// StandaloneApplet is an applet that runs either as
// an applet or a standalone application. To run
// standalone, it provides a main method that creates
// a frame, then creates an instance of the applet and
// adds it to the frame.
public class WindowApplet extends Applet{
public void init(){
add(new Button("Hello Button"));
}
public static void main(String args[]){
// Create the frame this applet will run in
Frame myWindow = new Frame("Applet inside Application");
// Create an instance of the applet
Applet myApplet = new WindowApplet();
// Initialize and start the applet
myApplet.init();
myApplet.start();
// Add the applet to the frame
myWindow.add(myApplet);
// Have to give the frame a size before it is visible
myWindow.setSize(new Dimension(300, 100));
// Make the frame appear on the screen
myWindow.show();
}
}