package untitled20;import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */public class Applet2 extends JApplet {
  private boolean isStandalone = false;
  JPanel jPanel1 = new JPanel();
  Object[] Itemstr = {"1","2","3","4","5"};
  JTextField jTextField1 = new JTextField();
  JComboBox jComboBox1 = new JComboBox(Itemstr);
  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }  //Construct the applet
  public Applet2() {
  }
  //Initialize the applet
  public void init() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
  //Component initialization
  private void jbInit() throws Exception {
    this.setSize(new Dimension(400,300));
    jTextField1.setText("jTextField1");
    jComboBox1.addItemListener(new Applet2_jComboBox1_itemAdapter(this));
    this.getContentPane().add(jPanel1, BorderLayout.SOUTH);
    jPanel1.add(jTextField1, null);
    jPanel1.add(jComboBox1, null);
  }
  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }  //static initializer for setting look & feel
  static {
    try {
      //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    }
    catch(Exception e) {
    }
  }  void jComboBox1_itemStateChanged(ItemEvent e) {
   jTextField1.setText(jComboBox1.getSelectedItem().toString());
  }
}class Applet2_jComboBox1_itemAdapter implements java.awt.event.ItemListener {
  Applet2 adaptee;  Applet2_jComboBox1_itemAdapter(Applet2 adaptee) {
    this.adaptee = adaptee;
  }
  public void itemStateChanged(ItemEvent e) {
    adaptee.jComboBox1_itemStateChanged(e);
  }
}
JBuilder8下以测试通过。