你用JDK1。3或1。4编译吗,用JDK1。2吧或加参数 -target 1.1

解决方案 »

  1.   

    public void addActionListener(ActionListener l)
    Adds the specified action listener to receive action events from this button. Action events occur when a user presses or releases the mouse over this button. If l is null, no exception is thrown and no action is performed.Parameters:l - the action listener
      

  2.   

    参数的问题,把this改成null试试。运行时可能仍有异常,但是能通过编译
      

  3.   

    my1.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e){
        //执行操作
      }
      
    })
      

  4.   

    你的yfsymain类没有实现相应接口。在extends Applet 后面加implements ActionListener;
    然后还要给yfsymain类定义一个public void actionPerformed(ActionEvent e)方法。