这是我调好的程序,测试成功package untitled5;import java.awt.*;
import javax.swing.*;//import sun.java2d.loops.CustomComponent;import java.awt.event.*;public class TJButton
    extends JApplet { //结果不对 啊郁闷!!!
  JButton button1, button2, button3;  Icon metalIcon = new ImageIcon("metal.gif");
  Icon motifIcon = new ImageIcon("motif.gif");
  Icon windowIcon = new ImageIcon("window.gif");  String metallicLF = "javax.swing.plaf.metal.MetalLookAndFeel";
  String motifLF = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
  String windowLF = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";  public void init() {    GridLayout grid = new GridLayout(1, 3, 5, 5);
    this.getContentPane().setLayout(grid);
    this.getContentPane().setBackground(Color.lightGray);    button1 = new JButton("Java L&F", metalIcon);
    button1.setVerticalTextPosition(SwingConstants.BOTTOM);
    button1.setHorizontalTextPosition(SwingConstants.CENTER);
    button1.setMnemonic('J');
    button1.setEnabled(false);
    button1.setActionCommand(metallicLF);
    CustomListener c1 = new CustomListener(this);
    button1.addActionListener(c1);
    this.getContentPane().add(button1);    button2 = new JButton("Motif L&F", motifIcon);
    button2.setVerticalTextPosition(SwingConstants.BOTTOM);
    button2.setHorizontalTextPosition(SwingConstants.CENTER);
    button2.setMnemonic('M');
    button2.setActionCommand(motifLF);
    CustomListener c2 = new CustomListener(this);
    button2.addActionListener(c2);
    this.getContentPane().add(button2);    button3 = new JButton("Window L&F", windowIcon);
    button3.setVerticalTextPosition(SwingConstants.BOTTOM);
    button3.setHorizontalTextPosition(SwingConstants.CENTER);
    button3.setMnemonic('W');
    button3.setActionCommand(windowLF);
    CustomListener c3 = new CustomListener(this);
    button3.addActionListener(c3);
    this.getContentPane().add(button3);  }  class CustomListener
      implements ActionListener {    TJButton testApplet = null;
    public CustomListener(TJButton testApplet) {
      this.testApplet = testApplet;    }    public void actionPerformed(ActionEvent evt) {
      String LF = evt.getActionCommand();
      try {
        UIManager.setLookAndFeel(LF);
        SwingUtilities.updateComponentTreeUI(testApplet);
        JButton button = (JButton) evt.getSource();
        button.setEnabled(false);
        updateStatus(button);      }
      catch (Exception e) {
        System.err.println("Look and Feel not set for " + LF + "!");      }
    }    public void updateStatus(JButton button) {
      if (button == button1) {
        button2.setEnabled(true);
        button3.setEnabled(true);
      }
      else if (button == button2) {
        button1.setEnabled(true);
        button3.setEnabled(true);
      }
      else if (button == button3) {
        button1.setEnabled(true);
        button2.setEnabled(true);      }
    }
  }}