//These are some of the standard "imports" we'll be using, explained in class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;

public class GenericWithScrolling extends Applet implements ActionListener {

   JTextArea  output;
   JTextField input;
   JButton button;


   public void init() {

      setLayout(new BorderLayout());

      // Create the text-area and button we'll use
      input  = new JTextField(8);
      output = new JTextArea();
      button = new JButton("Press Me!");

      // Next we create a "panel" that we add button to
      JPanel p = new JPanel();
      p.setLayout(new FlowLayout());
      p.add(new JLabel("input: "));
      p.add(input);
      p.add(button);

      // Finally, to finish building the UI, we simply add the text and the panel
      // (which contains the button) to the applet
      add("Center", new JScrollPane(output));
      add("South", p);

      // Lastly, we instruct the applet to "listen" for the button to be pressed
      button.addActionListener(this);
   }

   public void actionPerformed(ActionEvent evt) {

      output.append("Hello! You entered '" + input.getText() + "' for input\n");

   }
}
