如何将小程序加入到WEB页中
这段是小程序,显示时间的
import java.awt.*;
import java.util.*;
public class Watch extends javax.swing.JApplet
{
private Color butterscotch = new Color(255, 204, 102);
private String lastTime = "";
public void init()
{
setBackground(Color.black);
}
public void paint(Graphics screen)
{
Graphics2D screen2D = (Graphics2D)screen;
Font type = new Font("Monospaced", Font.BOLD, 20);
screen2D.setFont(type);
GregorianCalendar day = new GregorianCalendar();
String time = day.getTime().toString();
screen2D.setColor(Color.black);
screen2D.drawString(lastTime, 5, 25);
screen2D.setColor(butterscotch);
screen2D.drawString(time, 5, 25);
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
//do nothing
}
lastTime = time;
repaint();
}
}
已编译生成Watch.class
这段是html源码
<html>
<head>
<title>Watch Applet</tilte>
</head>
<body>
<applet code="Watch.class" height="50" width="345">
This program requires a Java-enabled browser.
</applet>
</body>
</html>
为什么我打开html却没有任何东西
是不是漏了什么