源程序:
import java.applet.*;              
  import java.awt.*;                  
  import java.awt.event.*;            
  public class ImplementActionListener extends Applet implements ActionListener
  {                                  
   TextField password = new TextField("我是密码"); 
    Button btn = new Button("隐藏");   
    public void init()                 
   {                                 
    add(password);                  
     add(btn);                        
     btn.addActionListener(this);    
   }                                 
   public void actionPerform(ActionEvent e) 
   {                                 
     password.setEchoChar('*');
     password.selectAll();            
   }                                  
 } 
========================
错误提示:
--------------------Configuration: j2sdk1.4.0 <Default>--------------------
E:\javaexerces\ImplementActionListener.java:4: ImplementActionListener should be declared abstract; it does not define actionPerformed(java.awt.event.ActionEvent) in ImplementActionListener
  public class ImplementActionListener extends Applet implements ActionListener
         ^
1 errorProcess completed.

解决方案 »

  1.   

    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;public class ImplementActionListener extends Applet implements ActionListener {
        TextField password = new TextField("我是密码");    Button btn = new Button("隐藏");    public void init() {
            add(password);
            add(btn);
            btn.addActionListener(this);
        }    public void actionPerform(ActionEvent e) {
            password.setEchoChar('*');
            password.selectAll();
        }    /* (non-Javadoc)
         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         */
        public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            
        }
    }