// beginner's guide to applets:
// part 2: getting I/O from the user through the HTML page
//
// K.Becker

import java.awt.*;
import java.awt.event.*;
import java.applet.*; 

import java.net.*; // to get at stuff over the net
import java.io.*;  // for reading and stuff

import java.lang.*;

//------------------------------------------

 public class DoForm extends Applet implements
     ActionListener {
   Button b;
   TextField t;
   Font new_font;
   Graphics g;
   
   public void init() {
      setBackground( Color.pink );
      t = new TextField(40);
      add(t);
      b = new Button("Repeat After Me!!");
      add(b);
      b.addActionListener(this);
      }
   
   public void actionPerformed(ActionEvent ae) {
      if (ae.getSource() == b) {
        try {
	  new_font = new Font("Helvetica",Font.BOLD,16);
	  g = getGraphics();
	  g.setFont( new_font );
	  update(g);
          g.drawString(t.getText(),80,150);
          }
        catch (Exception e) {
          e.printStackTrace();
          }
        }
      }
   }


//-------------------------------------------
