还是昨天的问题
我编写的代码只能用appletviewer显示!!!
在网页里显示如下
提示说找不到SnowMan.class
这是applet标记
<applet code="SnowMan.class" width="300" height="200">
</applet>
这是java程序
import javax.swing.JApplet;
import java.awt.*;
public class SnowMan extends JApplet
{
public void paint(Graphics page)
{
final int MID=150;
final int TOP=50;
setBackground(Color.pink);
page.setColor(Color.blue);
page.fillRect(0,175,300,50);
page.setColor(Color.yellow);
page.fillOval(-40,-40,80,80);
page.setColor(Color.white);
page.fillOval(MID-20,TOP,40,40);
page.fillOval(MID-35,TOP+35,70,50);
page.fillOval(MID-50,TOP+80,100,60);
page.setColor(Color.black);
page.fillOval(MID-10,TOP+10,5,5);
page.fillOval(MID+5,TOP+10,5,5);
page.drawArc(MID-10,TOP+20,20,10,190,160);
page.drawLine(MID-10,TOP+60,MID-50,TOP+40);
page.drawLine(MID+25,TOP+60,MID+55,TOP+60);
page.drawLine(MID-20,TOP+5,MID+20,TOP+5);
page.fillRect(MID-15,TOP-20,30,25);
}
}
----------------解决方案--------------------------------------------------------
你的class文件是不是和网页文件放在一个目录下面
----------------解决方案--------------------------------------------------------
都是放在一个目录下的啊!!
----------------解决方案--------------------------------------------------------