//Applet1.javaimport java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */public class Applet1 extends Applet {
  private boolean isStandalone = false;
  JTextArea jTextArea1 = new JTextArea();
  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }  //Construct the applet
  public Applet1() {
  }
  //Initialize the applet
  public void init() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  //Component initialization
  private void jbInit() throws Exception {
    jTextArea1.setText("jTextArea1");
    this.add(jTextArea1, null);
  }
  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }
}just test

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <title>
    HTML Test Page
    </title>
    </head>
    <body>
    httpproxy.Applet1 will appear below in a Java enabled browser.<br>
    <applet
      codebase = "."
      code     = "Applet1.class"
      name     = "TestApplet"
      width    = "400"
      height   = "300"
      hspace   = "0"
      vspace   = "0"
      align    = "middle"
    >
    </applet>
    </body>
    </html>
    just test
      

  2.   

    import java.awt.*;
    import java.applet.*;
    public class dd extends Applet
    {
    public void init()
    {
    this.add(new TextField());
    }
    }
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GBK">
    <title>
    HTML Test Page
    </title>
    </head>
    <body>
    这样就会有一个框了<br>
    <applet
      codebase = "."
      code     = "dd.class"
      name     = "TestApplet"
      width    = "400"
      height   = "300"
    >
    </applet>
    </body>
    </html>