import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class ImpletmentAction extends Applet implements ActionListener{
  TextField password=new TextField("我是密码 ");
  Button btn=new  Button ("隐藏 ");
  public void init(){
    add(password);
    add(btn);
    btn.addActionListener(this);
    }
public void actionPerformed(ActionEvent e){
  password.setEchoChar('*');
  password.selectAll();
  }
}系统报错:Exception in thread "main" java.lang.NoSuchMethodError: main 
我的方法错在那里了?是不是JDK版本的问题?

解决方案 »

  1.   

    没有main方法 不能直接运行 可以嵌到网页里 或者弄个applet查看器
      

  2.   

    Exception in thread "main" java.lang.NoSuchMethodError: main
    上面不是写的很清楚吗
      

  3.   

    可以在eclipse下,以applet方式运行
      

  4.   

    Applet程序得嵌套在一个Frame,JFame或者一个html里面方能运行
      

  5.   

    别执行application,要执行applet!
      

  6.   


    import java.applet.*;
    import java.awt.*;
    public class Dashan extends Applet{
         public void paint(Graphics g){
                g.setColor(Color.red);
                g.drawString("我的名字叫大山,我家住在加拿大,问我现在在干吗?坐在这里学Java!",2,30);
                g.setColor(Color.blue);
                g.drawString("我很认真",10,50);
                }
    }<html>
    <body>
    <applet code="Dashan.class" width=300 height=500>
    </applet>
    </body
    </html>
      

  7.   

    别执行application,要执行applet!
      

  8.   

    嘿嘿,,,,,http://www.japee.com.cn/jew/pages/Main.aspx
      

  9.   

    我的目的也是执行applet,但是怎么就变成了执行application!
      

  10.   

    没有main方法 当然不能直接运行 不过可以嵌到网页里