import java.applet.Applet; 
public class DoNothing extends Applet 

里面什么都没有呀,要初始化一下!
 public void init()
{}public void paint(Graphics g)
{
 g.drawString("hello",20,20);
}

解决方案 »

  1.   

    请教(一个女农民) ,如果不装jre插件能显示出hello吗?
      

  2.   

    把你的html文件存成DoNothing.html,然后APPLETVIEWER DoNothing.html
      

  3.   

    给你一个applet的例子:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;public class ShowDocument extends Applet implements ActionListener
    {
    URLWindow urlWindow;
    public void init()
    {
    Button button=new Button("Bring up URL window");
    button.addActionListener(this);
    add(button);
    urlWindow=new URLWindow(getAppletContext());
    urlWindow.pack();
    }

    public void destory()
    {
    urlWindow.setVisible(false);
    urlWindow=null;
    } public void actionPerformed(ActionEvent event)
    {
    urlWindow.setVisible(true);
    }
    }
    html文件:
    <html>
    <body>
    <applet code="ShowDocument.class"
    width=500 height=300
    name="ShowDocument"
    >
    </applet>
    </body>
    <html>
      

  4.   

    编译了没有啊??
    怎么编译的??
    JAVAC 不能运行??
      

  5.   

    你不能用javac 编译
    必须用appletview *.java
      

  6.   

    问题解决了,谢谢各位!我是一个新手问题的描述不是很清楚,让各位高手疑惑,实在是不好意思!因为我的HTML文件是用WORD编写的,后来我在FONTPAGE里重新输入后,运行就一点问题也没有。我也不明白这是什么原因,多谢大家!