请帮我看看这个插入HTML页的java小程序为什么不能运行?

来源:百度知道 编辑:UC知道 时间:2024/06/19 02:00:13
源代码如下:

// Decompiled Using: FrontEnd Plus v2.03 and the JAD Engine
// Available From: http://www.reflections.ath.cx
// Decompiler options: packimports(3)
// Source File Name: swquxian.java

import java.applet.Applet;
import java.awt.*;
import java.util.Date;

public class swquxian extends Applet
{

public void stop()
{
controls.disable();
}

public swquxian()
{
c = new ArcCanvas();
d = new Date();
by = 0;
bm = 1;
bd = 2;
}

public static void main(String args[])
{
Frame f = new Frame("swquxian");
swquxian swquxian = new swquxian();
swquxian.init();
swquxian.start();
f.add("Center", swquxian);

applet 里有main方法 ??

好好阅读下applet的API

applet 里没有main方法的

applet的主函数类是Applet不需要main

看倒数第六、七行,有两个类的变量.错误是因为你没有引入那两个类。所以没办法使用他们定义变量。
而且还真不知道用的是哪个类,jdk索引里还真没有,看来你需要到那个人的网站上再补完一下。
而且他并没有显式引入,所以这两个类一定和你的这段代码位于同一个包中!

看倒数第六、七行,有两个类的变量.错误是因为你没有引入那两个类。所以没办法使用他们定义变量。
在APPLET中没有main方法,从init方法入口。
APPLET要在网页中运行中
要把它放到HTML中