import java.applet.Applet; import java.awt.*; // This appears in Core Web Programming from // Prentice Hall Publishers, and may be freely used // or adapted. 1997 Marty Hall, hall@apl.jhu.edu. /** Illustrates use of the showPage method of ShowHTML. * Generates HTML on-the-fly and sends it to the * browser via the "javascript:" URL. Using JSObject * is much more flexible, but this approach doesn't * require any special Java classes. * Only works in Netscape 3.0 and later. */ public class TestHTML extends Applet { private LabeledTextField sampleLine, frameName; public void init() { setBackground(Color.white); sampleLine = new LabeledTextField("Sample HTML:", 80); frameName = new LabeledTextField("Frame Name:", 15); add(sampleLine); add(frameName); add(new Button("Generate HTML")); } public boolean action(Event e, Object o) { String text = sampleLine.getTextField().getText(); String frame = frameName.getTextField().getText(); String html = "
" + "