利用applet标签载入applet
2008-01-05 08:51:20 来源:WEB开发网核心提示:下面是applet.jsp代码,主要说明了<applet>的用法<%@ page contentType="text/Html; charset=GB2312"%><%@ page language="java" %><HTML>&
下面是applet.jsp代码,主要说明了<applet>的用法
<%@ page contentType="text/Html; charset=GB2312"%>
<%@ page language="java" %>
<HTML>
<HEAD>
<TITLE>利用<applet>载入applet</TITLE>
</HEAD>
<BODY>
<CENTER>
<FONT SIZE = 5 COLOR = blue>利用<applet>载入applet</FONT>
</CENTER>
<BR>
<HR>
<BR>
<CENTER>
<!-- 载入applet -->
<applet code="HelloWorld.class" height="50" width="320" >
<param name="name" value="Applet Demo">
</applet>
</CENTER>
<BR>
</BODY>
</HTML>
其中HelloWorld.class是HelloWorld.java编译以后的文件,HelloWorld.java代码如下:
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet
{
String name;
public void init()
{
name = getParameter("name");
}
public void paint(Graphics g)
{
g.drawString(" This is " + name + "!", 60, 25);
}
}
更多精彩
赞助商链接