最近有一点时间,所以开始学习一些Applet的知识。
昨天写了一个Applet的例子在Firefox里面运行,Firefox先提示要插件,接着又提示安装JRE(本来已经在机子上安装了JRE的了)。折腾了很久,终于可以运行一个简单的Applet了。
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<applet code="AppletTest" width=50 height=50></applet>
</body>
</html>
AppletTest
import java.awt.Graphics;
import javax.swing.JApplet;
public class AppletTest extends JApplet{
/**
*
*/
private static final long serialVersionUID = -1236552617781509416L;
public void paint(Graphics g){
g.drawString("test", 10, 10);
}
}