import java.awt.*;
import java.awt.event.*;

/** Whenever an item is activated, it is displayed
 *  in the textfield that was supplied to the
 *  ActionReporter constructor.
 *
 *  Taken from Core Web Programming from 
 *  Prentice Hall and Sun Microsystems Press,
 *  http://www.corewebprogramming.com/.
 *  &copy; 2001 Marty Hall and Larry Brown;
 *  may be freely used or adapted. 
 */

public class ActionReporter implements ActionListener {
  private TextField actionField;

  public ActionReporter(TextField actionField) {
    this.actionField = actionField;
  }

  public void actionPerformed(ActionEvent event) {
    List source = (List)event.getSource();
    actionField.setText(source.getSelectedItem());
  }
}
