以下代码经过测试,你可以try
//: ButtonChange.java
// Looks like Java 1.1 but with J's added
package c13.swing;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;public class ButtonChange extends Applet {
static boolean firstPro=true;
  JButton b1 = new JButton("first is ready");
  JTextArea t = new JTextArea();
  public void init() {
    ActionListener al = new ActionListener() {
      public void actionPerformed(ActionEvent e){
        String name;
        if(firstPro){
         name =((JButton)e.getSource()).getText();          
          ((JButton)e.getSource()).setText("first is not ready");
          firstPro=false;
        }
        else{
          name =((JButton)e.getSource()).getText();          
          ((JButton)e.getSource()).setText("first is ready");
          firstPro=true;
        }   
        t.setText(name + "\n is Pressed");     
      }
    };
    b1.addActionListener(al);
    add(b1);    
    add(t);
  }
  public static void main(String args[]) {
    ButtonChange applet = new ButtonChange();
    JFrame frame = new JFrame("TextAreaNew");
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e){
        System.exit(0);
      }
    });
    frame.getContentPane().add(
      applet, BorderLayout.CENTER);
    frame.setSize(300,100);
    applet.init();
    applet.start();
    frame.setVisible(true);
  }
} ///:~