你还的用HTML语言在写一个脚本语言:
<html><head>
<title>写上你程序的主题
</title>
<body>
<applet code="Applet2。class">
</applet>
</body>
</html>
保存用。htm后缀名
在运行看看

解决方案 »

  1.   

    你得IE浏览器不支持swing包里的类,到SUN网站下个新的java运行环境,也就是jre.exe之类的文件,要最新的最好.
      

  2.   

    我按二楼的兄弟写的htm页面还是显示为灰色,而如果我照下面这么写htm却可以显示,是什么原因??
    <html><head><title>Applet2</title></head><hr>
    <OBJECT 
      classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
      width="200" height="200" align="baseline"  codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
    <PARAM NAME="code" VALUE="Applet2.class">
    <PARAM NAME="codebase" VALUE=".">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
    <COMMENT>
      <EMBED type=
        "application/x-java-applet;version=1.2.2" 
        width="200" height="200" align="baseline"
        code="Applet2.class" codebase="."
    pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html">
      <NOEMBED>
    </COMMENT>
       No Java 2 support for APPLET!!
      </NOEMBED>
    </EMBED>
    </OBJECT>
    <hr></body></html>