java中的applet

来源:百度知道 编辑:UC知道 时间:2024/05/24 16:18:54
package firstApplet;

import java.applet.Applet;
import java.awt.Graphics;

public class firstApplet extends Applet {
String name=new String();
static int a=0;
public void init(){
name=getParameter("name");
String b=getParameter("age");
a=Integer.parseInt(b);
}
public void paint(Graphics g){
g.drawString("Name:"+name, 20, 20);
g.drawString("age:"+a, 20, 50);
}

}

<html>
<head>
<title>My firstApplets</title>
</head>
<body>
<applet code="firstApplet.class" width="200" height="200">
<param name=name value="sql">
<param name=age value="12">
</APPLET>
</body>
</html>
运行时 这么老是说未启动。。java文件已经编辑成class 文件
未初始化小程序,,帮我看看有没有错误 感谢了。。
我的class文件在 E:\workspa

package firstApplet;

import java.applet.Applet;
import java.awt.Graphics;

public class firstApplet extends Applet {
String name=new String();
static int a=0;
public void init(){
name=getParameter("name");
String b=getParameter("age");
a=Integer.parseInt(b);
}
public void paint(Graphics g){
g.drawString("Name:"+name, 20, 20);
g.drawString("age:"+a, 20, 50);
}

}

<html>
<head>
<title>My firstApplets</title>
</head>
<body>
<applet code="firstApplet.firstApplet.class" width="200" height="200">
<param name=name value="sql">
<param name=age value="12">
</APPLET>
</body>
</html>

<applet code="firstApplet.firstApplet.class" width="